mongodb中怎么用pull把一个数组中相同的元素,只删除一个?
展开全部
node.js中删除monogodb数组子文档备薯使用$pull关仿世者键词
参考代码:返禅
var filter = {_id: suggestID};
var update = {$pull: {replies: {rid:opts.doc.rid}}};
return opts.dbs.csdb.collection("suggests").findOneAndUpdateAsync(filter, update, {upsert: false})
参考代码:返禅
var filter = {_id: suggestID};
var update = {$pull: {replies: {rid:opts.doc.rid}}};
return opts.dbs.csdb.collection("suggests").findOneAndUpdateAsync(filter, update, {upsert: false})
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询