Files
mongo/jstests/update2.js

19 lines
398 B
JavaScript
Raw Normal View History

2009-01-27 14:18:33 -05:00
f = db.ed_db_update2;
2009-01-27 16:16:53 -05:00
f.drop();
2009-01-27 14:18:33 -05:00
f.save( { a: 4 } );
f.update( { a: 4 }, { $inc: { a: 2 } } );
assert.eq( 6, f.findOne().a );
f.drop();
f.save( { a: 4 } );
f.ensureIndex( { a: 1 } );
f.update( { a: 4 }, { $inc: { a: 2 } } );
assert.eq( 6, f.findOne().a );
2009-01-28 09:58:54 -05:00
// Verify that drop clears the index
f.drop();
f.save( { a: 4 } );
f.update( { a: 4 }, { $inc: { a: 2 } } );
2009-01-31 17:22:22 -05:00
assert.eq( 6, f.findOne().a );