Files
mongo/jstests/core/bad_index_plugin.js
Rishab Joshi 4329ffafa3 SERVER-50442 Remove ensureIndex shell function
This commit replaces all the usages of ensureIndex() with createIndex() in JS tests and JS shell""
2020-11-17 14:23:10 +00:00

12 lines
352 B
JavaScript

// SERVER-5826 ensure you can't build an index with a non-existent plugin
t = db.bad_index_plugin;
assert.commandWorked(t.createIndex({good: 1}));
assert.eq(t.getIndexes().length, 2); // good + _id
var err = t.createIndex({bad: 'bad'});
assert.commandFailed(err);
assert(err.code >= 0);
assert.eq(t.getIndexes().length, 2); // good + _id (no bad)