MongoDB C# driver 2.0 InsertManyAsync vs BulkWriteAsync
I found the answer looking at the driver source code: the InsertManyAsync
uses internally the BulkWriteAsync
.
So using InsertManyAsync
it's the same as writing:
List<BsonDocument> documents = ...collection.BulkWriteAsync(documents.Select(d => new InsertOneModel<BsonDocument>(d)));
Obviously, if all operations are Inserts, the InsertManyAsync
should be used.