コード例 #1
0
        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));
        }
コード例 #2
0
        public static IEnumerable <WriteModel <DynamicWrapper> > CreateMongoBulk(MongoDocumentFilterBuilder <DynamicWrapper> filterBuilder, Action <IDocumentBulkBuilder> requests)
        {
            var builder = new MongoDocumentBulkBuilder(filterBuilder);

            requests?.Invoke(builder);

            return(builder._operations);
        }