[SERVER-67404] mongo shell createIndex(es) helpers can error out with "Invalid field specified for createIndexes command: commitQuorum" when targeting a 4.2 cluster Created: 21/Jun/22  Updated: 06/Dec/22  Resolved: 12/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Alex Bevilacqua Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Operating System: ALL
Participants:
Case:

 Description   

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.



 Comments   
Comment by Connie Chen [ 12/Jul/22 ]

Closing this as we do not plan to make any changes to the shell in 4.2, this also seems to cause minimal impact. We acknowledge the error message can be confusing, but this scenario doesn't exist in 4.4+ versions.

Generated at Thu Feb 08 06:08:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.