|
Currently we don't return the number of docs inserted, or the number that error'd out, or, in the continueOnError case, a list of errors.
> db.test1.insert([{_id:1}, {_id:1}, {_id:1}]); db.getLastErrorObj()
|
{
|
"err" : "E11000 duplicate key error index: github.test1.$_id_ dup key: { : 1.0 }",
|
"code" : 11000,
|
"n" : 0,
|
"connectionId" : 1,
|
"ok" : 1
|
}
|
|
We should set "n" to successful docs inserted, and nFailures to the number of failed insertions (1 if continueOnError is false).
In addition we should return an errorDocs field like this:
errorDocs: [
|
{_id:1, err:"..."},
|
{_id:1, err:"..."},
|
{_id:1, err:"..."},
|
]
|
So the client will know which docs failed on the insert.
|