robbiblubber.org

help | login | search:  
>>

read  source  history 


insertMany()


MongoDB Driver Function Reference


Inserts multiple documents into a collection.
More information can be found in the corresponding entry of the MongoDB Manual.



<collection>.insertMany(<documents>[, <options>])



Arguments


<collection> The target collection.
<documents> An array of BSON documents to insert into the collection.
<options> A BOSN document specifying options.



Options


{ bypassDocumentValidation: <boolean>, ordered: <boolean> }

bypassDocumentValidation Document validation will be bypassed (default; false).
ordered Perform an ordered insert (default: true).



Example


db.employees.insertMany([{ name: "Miller", firstname: "Amanda", age: 29, salary: 680000 },
{ name: "Bower", firstname: "Debora", age: 46, salary: 840000 }]);


Inserts documents into the employees collection.




home | MongoDB Driver Function Reference | MongoDB Driver