mongoDB stores articles
A message has time, title, content, publisher and _id
Using JavaScript
The express framework of node.js used
Please post the code Thank you
May I ask what middleware the poster uses to operate mongodb? Here I will write it according to mongoose:
//因为不清楚楼主想要通过什么条件进行删除,通过id肯定不靠谱 //这里通过作者和文章标题进行查询并删除,使用的是findOne值查询一个 Passage.findOneAndRemove({author:"LiMing",title:"helloworld"}).exec();
db.person.remove(“name”:"ziling")
增db.collection("tb2").insert([{"name":"wilson001","age":21},{"name":"wilson002"},{"age":22}],function(err,result){})删db.collection("tb2").remove({"name":"wilson002"},function(err,result){});改db.collection("tb2").update({"name":"wilson001"},{$set:{"age":100}},function(err,result){});查db.collection("tb2").find({"name":"wilson001"}).toArray(function(err,result){});
May I ask what middleware the poster uses to operate mongodb? Here I will write it according to mongoose:
db.person.remove(“name”:"ziling")
增
db.collection("tb2").insert([{"name":"wilson001","age":21},{"name":"wilson002"},{"age":22}],function(err,result){})
删
db.collection("tb2").remove({"name":"wilson002"},function(err,result){});
改
db.collection("tb2").update({"name":"wilson001"},{$set:{"age":100}},function(err,result){});
查
db.collection("tb2").find({"name":"wilson001"}).toArray(function(err,result){});