我在MongoDB v2.2 NodeJS 0.8 MongoSkin 0.5 Framework中使用以下代码:

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 - new:true选项为我返回MongoDB中的旧值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15100544/

10-16 17:09