Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-67404

mongo shell createIndex(es) helpers can error out with "Invalid field specified for createIndexes command: commitQuorum" when targeting a 4.2 cluster

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL

      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.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            alex.bevilacqua@mongodb.com Alex Bevilacqua
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: