summaryrefslogtreecommitdiff
path: root/jstests/core/ddl/create_index_helper_validation.js
blob: 1b11a50c6ca83cec4e26e7fb90022d9eb82bbdd2 (plain)
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
29
// 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.createIndex(
                  /* keys */ {a: 1},
                  /* options */ {},
                  /* commitQuorum */ "majority",
                  {background: true},
                  {unique: true}));
}());