Files
mongo/jstests/core/find_and_modify_server6909.js
Randolph Tan 5595b94560 SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
2014-02-28 16:26:33 -05:00

22 lines
604 B
JavaScript

c = db.find_and_modify_server6906;
c.drop();
c.insert( { _id : 5 , a:{ b:1 } } );
ret = c.findAndModify( { query:{ 'a.b':1 },
update:{ $set:{ 'a.b':2 } }, // Ensure the query on 'a.b' no longer matches.
new:true } );
assert.eq( 5, ret._id );
assert.eq( 2, ret.a.b );
c.drop();
c.insert( { _id : null , a:{ b:1 } } );
ret = c.findAndModify( { query:{ 'a.b':1 },
update:{ $set:{ 'a.b':2 } }, // Ensure the query on 'a.b' no longer matches.
new:true } );
assert.eq( 2, ret.a.b );