1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Cannot implicitly shard accessed collections because of collection existing when none
// expected.
// @tags: [assumes_no_implicit_collection_creation_after_drop]
var coll = db.jstests_drop;
coll.drop();
res = coll.runCommand("drop");
assert(!res.ok, tojson(res));
assert.eq(0, coll.getIndexes().length, "A");
coll.save({});
assert.eq(1, coll.getIndexes().length, "B");
coll.ensureIndex({a: 1});
assert.eq(2, coll.getIndexes().length, "C");
assert.commandWorked(db.runCommand({drop: coll.getName()}));
assert.eq(0, coll.getIndexes().length, "D");
coll.ensureIndex({a: 1});
assert.eq(2, coll.getIndexes().length, "E");
assert.commandWorked(db.runCommand({deleteIndexes: coll.getName(), index: "*"}),
"delete indexes A");
assert.eq(1, coll.getIndexes().length, "G");
// make sure we can still use it
coll.save({});
assert.eq(1, coll.find().hint("_id_").toArray().length, "H");
|