summaryrefslogtreecommitdiff
path: root/jstests/core/write/update/update2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/write/update/update2.js')
-rw-r--r--jstests/core/write/update/update2.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/core/write/update/update2.js b/jstests/core/write/update/update2.js
new file mode 100644
index 00000000000..080875b50bd
--- /dev/null
+++ b/jstests/core/write/update/update2.js
@@ -0,0 +1,23 @@
+// Cannot implicitly shard accessed collections because of following errmsg: A single
+// update/delete on a sharded collection must contain an exact match on _id or contain the shard
+// key.
+// @tags: [assumes_unsharded_collection]
+
+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.createIndex({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);