summaryrefslogtreecommitdiff
path: root/jstests/core/capped/capped_upsert.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/capped/capped_upsert.js')
-rw-r--r--jstests/core/capped/capped_upsert.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/core/capped/capped_upsert.js b/jstests/core/capped/capped_upsert.js
new file mode 100644
index 00000000000..38f5afe3b24
--- /dev/null
+++ b/jstests/core/capped/capped_upsert.js
@@ -0,0 +1,19 @@
+/**
+ * Tests upserting into a capped collection with deletes needed.
+ *
+ * @tags: [
+ * requires_capped,
+ * # Capped collections cannot be sharded
+ * assumes_unsharded_collection,
+ * ]
+ */
+(function() {
+"use strict";
+
+const coll = db.capped_upsert;
+coll.drop();
+
+assert.commandWorked(db.createCollection(coll.getName(), {capped: true, size: 100000, max: 1}));
+assert.commandWorked(coll.insert({text: "a"}));
+assert.commandWorked(coll.save({_id: 123, text: "b"}));
+}());