Reputation: 2133
I'm using that method, but I do not know how to handle the result. I've checked that Bulk.insert() returns a promise, but I do not have much experience with that topic. This is my code:
bulk.insert({
id_cliente: val1,
iddoi: val2,
id_personeria: val3,
cliente: val4
});
bulk.execute()
I have no problems with data insertion, but I want to get the answer, because there are duplicate records and I need to know what they are.
Upvotes: 0
Views: 1056
Reputation: 139
you can use the BulkWriteResult object returned from the execute() call.
https://docs.mongodb.com/manual/reference/method/BulkWriteResult/#BulkWriteResult
if you need more details, you can call getOperations()
Upvotes: 0