|
The bulk insert operation stops at the first error by default.
If you look at the response from the bulk insert, you'll see it failed:
{
|
"writeErrors" : [
|
{
|
"index" : 104,
|
"code" : 11000,
|
"errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.batch_test.$_id_ dup key: { : \"http://www.bangladeshdir.com/type/health\" }",
|
"op" : {
|
"priority" : 0.1,
|
"seen" : false,
|
"_id" : "http://www.bangladeshdir.com/type/health"
|
}
|
}
|
],
|
"writeConcernErrors" : [ ],
|
"nInserted" : 104,
|
"nUpserted" : 0,
|
"nMatched" : 0,
|
"nModified" : 0,
|
"nRemoved" : 0,
|
"upserted" : [ ]
|
}
|
You can pass it an option to continue on error and then return a list of errors rather than stopping if you want.
db.batch_test.insert(data,true)
|
|