[CSHARP-1378] BulkWrite enumerates requests argument multiple times Created: 13/Aug/15  Updated: 29/Jul/22

Status: Backlog
Project: C# Driver
Component/s: Operations
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Michael Samoylenko Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: size-small
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-2385 Support lazy enumeration in BulkWrite Closed

 Description   

MongoCollection.BulkWriteAsync uses !requests.Any() to check if collection is empty, causing multiple enumeration.



 Comments   
Comment by Bouke Haarsma [ 10/Dec/20 ]

@James Smith - You must have mistaken me for a MongoDB employee.

Comment by James Smith [ 10/Dec/20 ]

@Bouke Haarsma - are you planning to fix this issue any time soon? This is a very serious issue so I would expect this to have been prioritised by now.

Comment by bhaarsma [ 08/Jan/19 ]

Currently Mongo will split bulk write operations into batches of 1000 items. While this is an implementation detail, we just batch items into sets of 1000 items before passing them off to the driver. As a side benefit, the original IEnumerable is only enumerated once when we perform the batching.

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