1.runCommand()函数可以执行mongoDB中的特殊函数,但一次只能处理一个文档
findAndModify为一个特殊的函数,它返回update或remove后的文档
例如:runCommand({
"findAndModify":"集合名",
query:{查询器},
sort{排序},
new:true,
update:{更新器},
remove:true
}).value
2.例如:
ps = db.runCommand({
"findAndModify":"persons",
"query":{"name":"text"},
"update":{"$set":{"email":"1221"}},
"new":true
})
ps.value
MongoDB_04之runCommand()函数
最新推荐文章于 2022-09-22 21:27:37 发布