-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: API
-
None
The BulkWriteResult contains properties like ModifiedCount, InsertedCount, and so on. But it doesn't have UpsertedCount.
F.e I have list of updating models:
// some method that creates models for updating private static UpdateOneModel<Entity> CreateUpdateModel(Record item) { var filter = Builders<Entity>.Filter.Eq(a => a.Id, item.Id); var update = Builders<Entity>.Update .Set(x => x.UserName, item.UserName) ... return new UpdateOneModel<Entity>(filter, update) {IsUpsert = true}; }
And then call:
var bulkResult = await _collection.BulkWriteAsync(bulkOps);
From the bulkResult I cannot understand how much was upserted, moreover, InsertedCount is 0 also.