summaryrefslogtreecommitdiff
path: root/jstests/core/collection_info_cache_race.js
blob: d57fc3340db7704f978ead33e29840dd7631e70b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Show case of initialized collection_info_cache crashing update

// Create collection without an index, then try to save a doc.
var coll = db.collection_info_cache_race;
coll.drop();
assert.commandWorked(db.createCollection(coll.getName(), {autoIndexId: false}));
// Fails when SERVER-16502 was not fixed, due to invariant
assert.writeOK(coll.save({_id: false}, {writeConcern: {w: 1}}));

coll.drop();
assert.commandWorked(db.createCollection(coll.getName(), {autoIndexId: false}));
assert.eq(null, coll.findOne());
assert.writeOK(coll.save({_id: false}, {writeConcern: {w: 1}}));