mongos doesn't accept write concern when index is created with insert command

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.5.5
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Clients can use a write concern when inserting into the system.indexes collection on mongos using OP_INSERT and getlasterror, but mongos doesn't accept a writeConcern field for inserts into system.indexes with the insert command:

      mongos> db.serverBuildInfo().version
      2.5.5-pre-
      mongos> db.serverBuildInfo().gitVersion
      ed76da14b416376045dfe84cf3ad5866bd4feb1f
      mongos> db.system.indexes.insert({key: {k: 1}, ns: 'test.collection', name: 'name'})
      mongos> db.getLastError(2)
      null
      mongos> db.collection.drop()
      true
      mongos> db.runCommand({insert: 'system.indexes', documents: [{key: {k: 1}, ns: 'test.collection', name: 'name'}], writeConcern: {w: 2}})
      {
      	"ok" : 0,
      	"code" : 72,
      	"errmsg" : "invalid batch request for index creation"
      }
      

      Creating an index on mongod with an insert command and writeConcern behaves as expected: the command blocks until the index is built on N replicas.

            Assignee:
            Randolph Tan
            Reporter:
            A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: