summaryrefslogtreecommitdiff
path: root/jstests/core/apply_ops_invalid_index_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/apply_ops_invalid_index_spec.js')
-rw-r--r--jstests/core/apply_ops_invalid_index_spec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/core/apply_ops_invalid_index_spec.js b/jstests/core/apply_ops_invalid_index_spec.js
index 01a4fab3a63..5ed9e6d8ee6 100644
--- a/jstests/core/apply_ops_invalid_index_spec.js
+++ b/jstests/core/apply_ops_invalid_index_spec.js
@@ -50,6 +50,24 @@
}),
ErrorCodes.InvalidIndexSpecificationOption);
+ // A createIndexes command for a background index with unknown field in the index spec should
+ // fail.
+ assert.commandFailedWithCode(db.adminCommand({
+ applyOps: [{
+ op: 'c',
+ ns: cmdNs,
+ o: {
+ createIndexes: t.getName(),
+ v: 2,
+ key: {a: 1},
+ background: true,
+ name: 'a_1_background',
+ unknown: 1,
+ },
+ }],
+ }),
+ ErrorCodes.InvalidIndexSpecificationOption);
+
// A createIndexes command for a v:1 index with an unknown field in the index spec should work.
const res1 = assert.commandWorked(db.adminCommand({
applyOps: [{