diff options
author | Hana Pearlman <hana.pearlman@mongodb.com> | 2021-04-16 16:27:29 +0000 |
---|---|---|
committer | Hana Pearlman <hana.pearlman@mongodb.com> | 2021-04-16 16:30:08 +0000 |
commit | 00c53e2a6fc66cb545071c8354f687f32984a7eb (patch) | |
tree | 0ad1bf0bb470cd910e1e863d5eab20fccb340a75 | |
parent | 5125c021566323508211b2e54c2de70b985db1d8 (diff) | |
download | mongo-00c53e2a6fc66cb545071c8354f687f32984a7eb.tar.gz |
Permit compound wildcard index creation in js test
-rw-r--r-- | jstests/core/wildcard_index_validindex.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/jstests/core/wildcard_index_validindex.js b/jstests/core/wildcard_index_validindex.js index 24ecdcf77cf..460131d6244 100644 --- a/jstests/core/wildcard_index_validindex.js +++ b/jstests/core/wildcard_index_validindex.js @@ -59,6 +59,10 @@ createIndexAndVerifyWithDrop({"$**": 1}, createIndexAndVerifyWithDrop({"$**": 1}, {wildcardProjection: {_id: 0, a: 1, b: 1, c: 1}, name: kIndexName}); +// Can create compound wildcard indexes. +createIndexAndVerifyWithDrop({"$**": 1, "a": 1}, {wildcardProjection: {a: 0}, name: kIndexName}); +createIndexAndVerifyWithDrop({"a": 1, "$**": 1, }, {wildcardProjection: {a: 0}, name: kIndexName}); + // Cannot create a wildcard index with a non-positive numeric key value. coll.dropIndexes(); assert.commandFailedWithCode(coll.createIndex({"$**": 0}), ErrorCodes.CannotCreateIndex); @@ -95,10 +99,6 @@ assert.commandFailedWithCode(coll.createIndex({"a.$**": "text"}), ErrorCodes.Can assert.commandFailedWithCode(coll.createIndex({"a": "wildcard"}), ErrorCodes.CannotCreateIndex); assert.commandFailedWithCode(coll.createIndex({"$**": "wildcard"}), ErrorCodes.CannotCreateIndex); -// Cannot create a compound wildcard index. -assert.commandFailedWithCode(coll.createIndex({"$**": 1, "a": 1}), ErrorCodes.CannotCreateIndex); -assert.commandFailedWithCode(coll.createIndex({"a": 1, "$**": 1}), ErrorCodes.CannotCreateIndex); - // Cannot create an wildcard index with an invalid spec. assert.commandFailedWithCode(coll.createIndex({"a.$**.$**": 1}), ErrorCodes.CannotCreateIndex); assert.commandFailedWithCode(coll.createIndex({"$**.$**": 1}), ErrorCodes.CannotCreateIndex); |