B
B
bro-dev2017-12-28 00:03:25
JavaScript
bro-dev, 2017-12-28 00:03:25

How to implement many update or insert?

there is a model with a unique field, so you need to insert a lot of records there so that new ones are inserted, and duplicates do not appear.
now, when inserting, if there is at least 1 duplicate, it simply cancels the entire request with an error
MongoError: E11000 duplicate key error collection

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Ghostuhin, 2018-01-04
@Torin_Asakura

Check it out if you have any questions - write
https://docs.mongodb.com/v3.0/reference/method/db....
https://docs.mongodb.com/manual/reference/method/d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question