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

Update documentation for BulkWrite to show how Upserts are done

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.2.2
    • Documentation
    • Major Change

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Zeioth Zeioth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: