| |
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 [[https://docs.mongodb.com/manual/reference/method/db.collection.insertMany/index.html|MongoDB Manual]].
[[[@cG
<collection>.insertMany(<documents>[, <options>])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <documents> | | An array of BSON documents to insert into the collection. |
| <options> | | A BOSN document specifying options. |
]]]
**Options**
[[[@cw
{ bypassDocumentValidation: <boolean>, ordered: <boolean> }
<<@f:text>>
|@t0@r0@c0 bypassDocumentValidation | | Document validation will be bypassed (default; false). |
| ordered | | Perform an ordered insert (default: true). |
<<@/f>>
]]]
**Example**
[[[@cw
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.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|