Javascript Bulk API {w:0} return errors in non-commands mode

XMLWordPrintableJSON

    • ALL
    • Hide
      bulkOp = coll.initializeOrderedBulkOp()
      bulkOp.insert({_id: 1})
      bulkOp.insert({_id: 1})
      result = bulkOp.execute({w: 0});
      

      returns the following error in legacy mode.

      {
      	"writeErrors" : [
      		{
      			"index" : 1,
      			"code" : 11000,
      			"errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.bulkOp_api_failure.$_id_  dup key: { : 1.0 }",
      			"op" : {
      				"_id" : 1
      			}
      		}
      	],
      	"writeConcernErrors" : [ ],
      	"nInserted" : 1,
      	"nUpserted" : 0,
      	"nMatched" : 0,
      	"nModified" : 0,
      	"nRemoved" : 0,
      	"upserted" : [ ]
      }
      
      Show
      bulkOp = coll.initializeOrderedBulkOp() bulkOp.insert({_id: 1}) bulkOp.insert({_id: 1}) result = bulkOp.execute({w: 0}); returns the following error in legacy mode. { "writeErrors" : [ { "index" : 1, "code" : 11000, "errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.bulkOp_api_failure.$_id_ dup key: { : 1.0 }" , "op" : { "_id" : 1 } } ], "writeConcernErrors" : [ ], "nInserted" : 1, "nUpserted" : 0, "nMatched" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      If running the shell in "commands" mode inserting two documents with identical _id fields and w = 0 gives no error in the bulk API.

      If however running in non-commands mode then a write error is returned. According to the spec behavior the expected behavior is to not return any error data in the response object (generated by the bulk api code in javascript).

            Assignee:
            DO NOT USE - Backlog - Platform Team
            Reporter:
            Andreas Nilsson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: