title: MongoDB C# Bulk partial update
body: <p>I have the following code (does not compile currently)</p>
  <pre><code>public async Task&lt;IResult&lt;bool&gt;&gt; UpdateStock(List&lt;Product&gt; products)
  {
      var bulkOps = products.Select(record =&gt; new UpdateOneModel&lt;Product&gt;(
              Builders&lt;Product&gt;.Filter.Where(x =&gt; x.ProductCode == record.ProductCode), 
              Builders&lt;Product&gt;.Update.Set(x =&gt; x.StockPointStocks.ElementAt(-1), record.StockPointStocks)
              )
          {
              IsUpsert = true
          })
          .Cast&lt;WriteModel&lt;Product&gt;&gt;()
          .ToList();
      await _databaseContext.ProductCollection().BulkWriteAsync(bulkOps);
  
      return await Result&lt;bool&gt;.SuccessAsync();
  }
  </code></pre>
  <p>What i'm trying to do from a given list of products bulk update the <code>StockPointStocks</code> and insert where we don't currently have the product in the DB, however i'm unsure how to finish off the second part of the Update.Set or if this is even the correct way of doing this.</p>
  <pre><code>public class Product
  {
      public Product()
      {
          Id = ObjectId.GenerateNewId();
      }
  
      [BsonId]
      [BsonRepresentation(BsonType.ObjectId)]
      public ObjectId Id { get; set; }
      public string ProductCode { get; set; }
      public List&lt;StockPointStock&gt; StockPointStocks { get; set; }
      public List&lt;FutureStock&gt; FutureStock { get; set; }
  }
  
  public class StockPointStock
  {
      public string Stockpoint { get; set; }
      public int Stock { get; set; }
      public DateTime LastUpdated { get; set; }
  }
  </code></pre>