[CSHARP-1602] Duplicate Key Error even when IsOrdered set to false. Created: 12/Mar/16  Updated: 14/Mar/16  Resolved: 14/Mar/16

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 2.2.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Zeioth Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 3.2.4



 Description   

This is the code I'm running:

InsertManyOptions options = new InsertManyOptions();
options.IsOrdered = false;
await collection.InsertManyAsync(
     records.ToBsonList(),
     options);

and this the error.
I didn't experienced it in MongoDB 3.2.3.



 Comments   
Comment by Zeioth [ 13/Mar/16 ]

It was a problem with my code. I was controlling a MongoDuplicateKeyException instead of MongoBulkWriteException.
From now on I'll post in the google group before to post here. Thank you so much for your time Craig.

Comment by Craig Wilson [ 13/Mar/16 ]

I guess I don't understand what your are indicating. IsOrdered doesn't really have anything to do with whether errors are reported. It only indicates that we won't stop on an error inside a single batch. If you don't care about errors, you need to set WriteConcern to w:0.

Comment by Zeioth [ 13/Mar/16 ]

I just tested it in version 3.2.3 but the error remains. To discard any problem with my code I made a reproducible example.

Comment by Craig Wilson [ 12/Mar/16 ]

Are you saying that this doesn't happen when using MongoDB version 3.2.3, but it does happen with MongoDB version 3.2.4. If that is true, this seems like it should be a SERVER ticket, not a CSHARP ticket. I can move it if you confirm this.

Craig

Generated at Wed Feb 07 21:40:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.