Skip to content Skip to sidebar Skip to footer

The New:true Option Returns Me The Old Value In Mongodb

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').findA

Solution 1:

set {w: 1} or, {safe: true} which is deprecated.

Solution 2:

in your query you search for: "{'code':code,..." and in the update you say "$push: {code.pub...

If your "code" field contains an object (sub-document) - your query will not find anything and the update will fail

Could you please post the complete statement (with the content of the variables) and an example of the document being updated?

Cheers

Ronald

Post a Comment for "The New:true Option Returns Me The Old Value In Mongodb"