我在 MongoDB v2.2 NodeJS 0.8 MongoSkin 0.5 框架中使用以下代码:
var db = mongo.db(admin+"@127.0.0.1:27017/database",{safe:true});
db.collection('collection').findAndModify({'code':code,'email':email},[],
{
$push:
{
'code.pub':newPub,
}
},{new:true},
function(err, result)
新的 true 选项返回 MongoDB 中的旧值。为什么会发生这种情况?怎么了?
最佳答案
设置{w: 1}
或{safe: true}
,已弃用。
关于javascript - 新的:true option returns me the old value in MongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15100544/