summaryrefslogtreecommitdiff
path: root/jstests/core/list_indexes_non_existent_ns.js
blob: 11a82746b0632fd3e15506ae6cd693fec2c7e10d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test the listIndexes command on non-existent collection.
(function() {
var dbTest = db.getSiblingDB("list_indexes_non_existent_db");
assert.commandWorked(dbTest.dropDatabase());

var coll;

// Non-existent database
coll = dbTest.getCollection("list_indexes_non_existent_db");
assert.commandFailed(coll.runCommand("listIndexes"));

// Creates the actual database that did not exist till now
coll.insert({});

// Non-existent collection
coll = dbTest.getCollection("list_indexes_non_existent_collection");
assert.commandFailed(coll.runCommand("listIndexes"));
}());