diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-06-24 11:24:54 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-06-24 11:24:54 -0400 |
commit | 1026c72507fb6eb7d2bc16d479d2ec86ac7032cd (patch) | |
tree | 0881acc6ee9aa04cdc823e16d4bae668598a34f9 /jstests/upsert1.js | |
parent | f8901bec591369af0a4b4588b3978a5239df657e (diff) | |
download | mongo-1026c72507fb6eb7d2bc16d479d2ec86ac7032cd.tar.gz |
getLastError has _id of of upserted object SERVER-1173
last error cleaning
Diffstat (limited to 'jstests/upsert1.js')
-rw-r--r-- | jstests/upsert1.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/jstests/upsert1.js b/jstests/upsert1.js new file mode 100644 index 00000000000..77cbf57c198 --- /dev/null +++ b/jstests/upsert1.js @@ -0,0 +1,14 @@ + +t = db.upsert1; +t.drop(); + +t.update( { x : 1 } , { $inc : { y : 1 } } , true ); +l = db.getLastErrorCmd(); +assert( l.upserted , "A1" ); +assert.eq( l.upserted.str , t.findOne()._id.str , "A2" ); + +t.update( { x : 2 } , { x : 2 , y : 3 } , true ); +l = db.getLastErrorCmd(); +assert( l.upserted , "B1" ); +assert.eq( l.upserted.str , t.findOne( { x : 2 } )._id.str , "B2" ); +assert.eq( 2 , t.find().count() , "B3" ); |