summaryrefslogtreecommitdiff
path: root/jstests/core/capped_upsert.js
blob: 38f5afe3b24398d15ccd6a5d45a3196b2224df6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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"}));
}());