summaryrefslogtreecommitdiff
path: root/jstests/update2.js
blob: ff9783348d42186793b48c1427b9bd144647f435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
f = db.ed_db_update2;

f.drop();
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( 4, f.findOne().a );

// Verify that drop clears the index
f.drop();
f.save( { a: 4 } );
f.update( { a: 4 }, { $inc: { a: 2 } } );
assert.eq( 6, f.findOne().a );