summaryrefslogtreecommitdiff
path: root/jstests/core/collMod_index_invalid_option.js
blob: ca8d5e71d0c434a420fa8ecea2bb8e04f9a54cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Tests that collMod fails when an unrecognized field is included in its 'index' option.
 *
 * @tags: [
 *   requires_non_retryable_commands,
 * ]
 */
(function() {

const collName = "collMod_index_invalid_option";

assert.commandWorked(db.getCollection(collName).createIndex({a: 1}, {expireAfterSeconds: 100}));

assert.commandFailedWithCode(db.runCommand({
    collMod: collName,
    index: {keyPattern: {a: 1}, expireAfterSeconds: 200, invalidOption: 1}
}),
                             40415 /* IDL unknown field error */);
})();