From 0faaf55bd9707797a86b5260bd241f6d292e19a8 Mon Sep 17 00:00:00 2001 From: Romain Date: Tue, 20 Dec 2011 16:35:32 +0100 Subject: [PATCH] Return the updated document is not clear. Mongo and Mongolian return the document as it was before the update. --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index ca149fa..d89f749 100644 --- a/Readme.md +++ b/Readme.md @@ -261,7 +261,7 @@ From http://api.mongodb.org/js/1.8.1/symbols/src/shell_collection.js.html + collection.find(...).sort(...) + collection.findOne([query][callback]) + collection.findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } ) - ex: finds document with comment value 0, increase its 'count' field by 1, and return the updated document. + ex: finds document with comment value 0, increase its 'count' field by 1, and return the old document. collection.findAndModify( {query: {comment:'0'}, update : {"$inc":{"count":1}}, 'new': true}, function (err, doc) { console.log(doc) })