[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: |
|
||||||||
| 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. |