public async Task <DocumentBulkResult> BulkAsync(Action <IDocumentBulkBuilder> requests, bool isOrdered = false) { var bulk = MongoDocumentBulkBuilder.CreateMongoBulk(_filterBuilder, requests); var result = await _collection.Value.BulkWriteAsync(bulk, new BulkWriteOptions { IsOrdered = isOrdered }); return(new DocumentBulkResult(result.RequestCount, result.MatchedCount, result.InsertedCount, result.ModifiedCount, result.DeletedCount)); }
public static IEnumerable <WriteModel <DynamicWrapper> > CreateMongoBulk(MongoDocumentFilterBuilder <DynamicWrapper> filterBuilder, Action <IDocumentBulkBuilder> requests) { var builder = new MongoDocumentBulkBuilder(filterBuilder); requests?.Invoke(builder); return(builder._operations); }