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

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

    • 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" : [ ] }

      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:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            andreas.nilsson Andreas Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: