Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4992

MongoCollectionImpl:BulkWriteAsync does multiple enumerations of requests

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Dotnet Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Within MongoCollectionImpl:BulkWriteAsync, there are 4 (in error case: 5) enumerations of the requests parameter, but the parameter is listed as IEnumerable. Since the requests are often build in client code by selecting over some input and mapping into UpdateModels, and the resulted linq tree just passed to BulkWrite, this will cause recreation of the UpdateModels over and over again, potentially causing side effects (we had issues in our code because of this).

      The code should do a conditinal if( requests is not ICollection) requests = requests.ToList() to prevent this from happening.

            Assignee:
            Unassigned Unassigned
            Reporter:
            stefan@stsz.de Stefan Szomraky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: