new:true选项为我返回MongoDB中的旧值 [英] The new:true option returns me the old value in MongoDB

查看:145
本文介绍了new:true选项为我返回MongoDB中的旧值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using the following code in 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中的旧值.为什么会这样呢?怎么了?

The new true option returns me the old value in MongoDB. Why is this happening? What is wrong?

推荐答案

设置{w: 1}或已弃用的{safe: true}.

这篇关于new:true选项为我返回MongoDB中的旧值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆