Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1121

Commit quorum does not work for createIndex helper

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.3
    • Affects Version/s: None
    • Component/s: Indexes, Shell API
    • None
    • Environment:
      mongod: 5.3.0-alpha1-87-g61ba21e
      mongosh: 1.1.9
    • 2
    • Not Needed
    • Iteration Versailles, Iteration Wolverhampton

      Problem Statement/Rationale

      The createIndexes() helper ignores the options passed to the third positional argument, which as documented as being the commitQuorum:

      db.collection.createIndexes( [ keyPatterns ], options, commitQuorum )
      

       

      Steps to Reproduce

      Start a 1-node replica set and create an index with the commitQuorum as "3":

      rs [direct: primary] test> db.test.createIndexes([{a: 1}], {}, 3)
      [ 'a_1' ]
      

      Expected Results

      Using the legacy shell:

      rs:PRIMARY> db.test.createIndexes([{a: 1}], {}, 3)
      {
              "ok" : 0,
              "errmsg" : "Not enough data-bearing voting nodes to satisfy commit quorum",
              "code" : 278,
              "codeName" : "UnsatisfiableCommitQuorum",
              "$clusterTime" : {
                      "clusterTime" : Timestamp(1644506422, 1),
                      "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0)
                      }
              },
              "operationTime" : Timestamp(1644506422, 1)
      }
      

      Actual Results

      The shell appears to be discarding the provided commitQuorum and using the default.

      Additional Notes

      None

            Assignee:
            leonardo.rossi@mongodb.com Leonardo Rossi (Inactive)
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: