From 62d257b9afe11758e3d831c32999d8d00aba1f9d Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Thu, 16 May 2013 18:35:17 +0300 Subject: [PATCH] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 5a01e22..c259853 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,11 @@ db.update({ planet: 'Pluton' }, { planet: 'Pluton', inhabited: false }, { upsert // numReplaced = 1, upsert = true // A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection }); + +// If you upsert with a modifier, the upserted doc is the query modified by the modifier +db.update({ planet: 'Pluton' }, { $set: { inhabited: false } }, { upsert: true }, function () { + // A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection +}); ```