[JAVA-2120] InsertMany should not stop on error Created: 24/Feb/16  Updated: 11/Sep/19  Resolved: 24/Feb/16

Status: Closed
Project: Java Driver
Component/s: Async
Affects Version/s: 3.2.2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Ben [X] Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Following scenario:
Writing thousands of entries to my MongoDb with insertMany.
If there are Problems (e.g. duplicate keys) the operation stops and I get one error in my callback.

would it be better to track that error and proceed inserting all other entries?
To show all errors the callback could give a list of throwables, instead of a single throwable.



 Comments   
Comment by Jeffrey Yemin [ 24/Feb/16 ]

No problem.

Comment by Ben [X] [ 24/Feb/16 ]

oh thank you!
thought it is per default unordered, my bad.

Comment by Jeffrey Yemin [ 24/Feb/16 ]

Please have a look at the com.mongodb.client.model.InsertManyOptions#ordered property. If you set it to false, it will work as you described.

Generated at Thu Feb 08 08:56:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.