Files
mongo/jstests/core/create_index_helper_validation.js

29 lines
894 B
JavaScript

// Tests that helper functions for creating indexes check the number of arguments passed.
(function() {
"use strict";
const coll = db.create_index_helper_validation;
coll.drop();
assert.throws(() => coll.createIndexes(
/* keys */[{a: 1}],
/* options */ {},
/* commitQuorum */ "majority",
{background: true},
{unique: true}));
assert.throws(() => coll.createIndex(
/* keys */ {a: 1},
/* options */ {},
/* commitQuorum */ "majority",
{background: true},
{unique: true}));
assert.throws(() => coll.ensureIndex(
/* keys */ {a: 1},
/* options */ {},
/* commitQuorum */ "majority",
{background: true},
{unique: true}));
}());