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

Possibility of doing an upsert with BulkWriteAsync

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.0.1
    • None

    Description

      Is it possible to perform an upsert when doing a BulkWriteAsync operation with UpdateOneModel requests?

      For instance:

      List<UpdateOneModel<BsonDocument>> updateStatements = new List<UpdateOneModel<BsonDocument>>();
       
      // Cannot set UpdateOptions object here to configure the udpdate to run as an upsert
      updateStatements.Add(new UpdateOneModel<FactData>(filter, update));
       
      var result = await db.GetCollection<BsonDocument>("test").BulkWriteAsync(updateStatements);
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            pgordon@truckdown.com Peter Gordon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: