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

write commands accept empty writeConcern document

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5.5
    • Component/s: Write Ops
    • Environment:
      db version v2.5.5-pre-
      2014-01-23T20:40:17.533-0500 git version: d91079d6d0d85b070c7d94376a441a7d41ae49f5
    • Replication
    • ALL

      This command:

      > db.test.runCommand({insert : "test", documents : [{}], writeConcern : {} } )
      

      returns:

      { "n" : 1, "ok" : 1 }
      

      Expected result:

      {
      	"ok" : 0,
      	"errmsg" : "'writeConcern' field is set to a document that is missing required fields",
      	"code" : 9
      }
      

      Other unsupported fields or value types in the writeConcern document will generate the incorrect response as well:

      > db.test.runCommand({insert : "test", documents : [], writeConcern : { wtimeout : true} } )
      > db.test.runCommand({insert : "test", documents : [], writeConcern : { foo : 1} } )
      > db.test.runCommand({insert : "test", documents : [], writeConcern : { j : false} } )  // not sure why this one is treated this way, as this is a legal value for j
      

      The command also allows extra unsupported fields like "foo" below:

      > db.test.runCommand({insert : "test", documents : [], foo : 1} )
      { "ok" : 1, "n" : 0 }
      

      Not sure if this is the intended behavior.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: