summaryrefslogtreecommitdiff
path: root/jstests/core/update2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/update2.js')
-rw-r--r--jstests/core/update2.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/core/update2.js b/jstests/core/update2.js
new file mode 100644
index 00000000000..654914c1f45
--- /dev/null
+++ b/jstests/core/update2.js
@@ -0,0 +1,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( 6, 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 );