How to Insert more than one document in a Single statement using InsertMany() MongoDB Method in C#
My MongoDB Database and Connections
IMongoClient _clie
Off the top of my head, the build error is most probably because the InsertMany
method is expecting a collection (IEnumerable
,List
or Array
..) of BsonDocument instead of a BsonArray
.
try :
var EmpInfoArray = new List<BsonDocument>() { //Changed BsonArray to List<BsonDocument>
new BsonDocument
{
{"EmpID", "100"},
{"EmpName", "John"},
{"EmpMobile", new BsonArray
.
.
.