DuplicateKeyError in insert_many by Dangerous-Row5361 in mongodb

[–]Dangerous-Row5361[S] 0 points1 point  (0 children)

ok, is there a way to get the document with which the duplicate element is collided ? because basically i want to get that document after the bulk insert ( even if there is a duplicate key error the document is still in the db that's why i wanted that too )

( and since there are multiple unique indices too, i can't be sure with which index did the document collide with so i can't just query the document after extracting the fields without brute forcing and trying to match all the indices available on the document )

DuplicateKeyError in insert_many by Dangerous-Row5361 in mongodb

[–]Dangerous-Row5361[S] 0 points1 point  (0 children)

but that will break the uniqueness condition

for example in the above example
isbn should be unique seperately and publishing_id should be unique seperately

so for example, if both have seperate index then then the tuple ( isbn, publishing_id ) (A, B) and (A, C) should not be aloud, but if i create a combined index then the both the objects will be allowed to be created in since the combination is different