blob: 660a2a714fc3eb44e7177aae808f5fb81d167dd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/**
* Ensures that creating an index with the same key but different name returns the
* 'IndexOptionsConflict' error.
*/
(function() {
'use strict';
const coll = "create_index_same_spec_different_name";
db.coll.drop();
assert.commandWorked(
db.runCommand({createIndexes: coll, indexes: [{key: {x: 1}, name: "x_1"}]}));
assert.commandFailedWithCode(
db.runCommand({createIndexes: coll, indexes: [{key: {x: 1}, name: "x_2"}]}),
ErrorCodes.IndexOptionsConflict);
}());
|