-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
ALL
-
(copied to CRM)
MongoDB 4.2 updated the mongo shell helper methods for createIndex(es) in SERVER-39760 adding a third parameter for commitQuorum.
Though the option to createIndexes wasn't added/documented until 4.4, according to SERVER-47193 the createIndexes command should accept commitQuorum as a no-op however it doesn't appear to work:
MongoDB shell version v4.2.20 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb MongoDB server version: 4.2.20 MongoDB Enterprise > db.foo.createIndex({ "bar": 1 }, { background: true }, { name: "baz" }); { "ok" : 0, "errmsg" : "Invalid field specified for createIndexes command: commitQuorum", "code" : 2, "codeName" : "BadValue" }
As 4.2 users would only encounter this if they accidentally passed 3 arguments to createIndexes the workaround is to fix their command:
MongoDB Enterprise > db.foo.createIndex({ "bar": 1 }, { background: true, name: "baz" }); { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 }
Tested on 4.2.20-ent.