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

Update documentation for BulkWrite to show how Upserts are done

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.2.2
    • Component/s: Documentation
    • 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?

      I migrated from 1.9 to 2.2 and reading the documentation I was surprised to discover that is not possible to upsert during a bulk operation anymore, since operations don't allow options.

      bulkOps.Add(new UpdateOneModel<BsonDocument>(filter, update));
      collection.BulkWrite(bulkOps);
      

      Should be

      options.isUpsert = true;
      bulkOps.Add(new UpdateOneModel<BsonDocument>(filter, update, options));
      collection.BulkWrite(bulkOps);
      

      Is this work in progress, intended, or I'm missing something? Thank you.

            Assignee:
            Unassigned Unassigned
            Reporter:
            Zeioth Zeioth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: