insert-batch duplicates issue

41 views
Skip to first unread message

Ben McFerren

unread,
Nov 25, 2015, 2:39:38 PM11/25/15
to Monger, a Clojure MongoDB driver
I have an array of objects that I would like to insert into my monger/mongodb

Some objects in this array have _id's that are already in the database

I am getting a duplicate error when I try to insert-batch objects from this array into the database

After some investigation, I've noticed that I with raw mongo I can make use of ContinueOnError with a Bulk insert operation but I am not sure of the syntax to use in order to accomplish this with Monger: http://stackoverflow.com/questions/21316898/mongodb-bulk-insert-where-many-documents-already-exist

db.collection.insert(myArray, {continueOnError: true}, callback)

I am very grateful for help you could offer.

All the best,

Ben

Michael Klishin

unread,
Nov 25, 2015, 2:43:07 PM11/25/15
to Monger, a Clojure MongoDB driver

2015-11-25 20:08 GMT+03:00 Ben McFerren <mcfe...@seasidesyndication.com>:
After some investigation, I've noticed that I with raw mongo I can make use of ContinueOnError with a Bulk insert operation but I am not sure of the syntax to use in order to accomplish this with Monger: http://stackoverflow.com/questions/21316898/mongodb-bulk-insert-where-many-documents-already-exist

monger.collection/insert-batch currently only accepts a write concern as an option but not additional
options:

Feel free to submit a pull request, e.g. replace write concern with a map of options, provided there would be
a way to specify per-operation write concern (if it matters at all with the 3.x Java driver).
--
Reply all
Reply to author
Forward
0 new messages