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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.5
    • None
    • Sharding
    • None
    • Fully Compatible
    • ALL

    Description

      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.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: