node.js - How to get multiple errors from initializeUnorderedBulkOp? -
i'm trying bulk insert of list of documents, @ end, know documents failed insert. mongo shell work , returns me insightful error:
bulkwriteerror({ "writeerrors" : [ { "index" : 3, "code" : 11000, "errmsg" : "e11000 duplicate key error collection: test.users index: _id_ dup key: { : 4.0 }", "op" : { "_id" : 4 } }, { "index" : 6, "code" : 11000, "errmsg" : "e11000 duplicate key error collection: test.users index: _id_ dup key: { : 6.0 }", "op" : { "_id" : 6 } } ], "writeconcernerrors" : [ ], "ninserted" : 6, "nupserted" : 0, "nmatched" : 0, "nmodified" : 0, "nremoved" : 0, "upserted" : [ ] })
but mongo node.js driver returns me first error happens:
{ mongoerror: e11000 duplicate key error collection: test.users index: _id_ dup key: { : 1 } name: 'mongoerror', message: 'e11000 duplicate key error collection: test.users index: _id_ dup key: { : 1 }', driver: true, code: 11000, index: 0, errmsg: 'e11000 duplicate key error collection: test.users index: _id_ dup key: { : 1 }', getoperation: [function], tojson: [function], tostring: [function] }
is there way in node.js driver full bulkerror?
Comments
Post a Comment