| |
read source history
= insert() =
----
[[MongoDB Driver Function Reference]]
Inserts multiple documents into a collection.
This method differs from the [[https://docs.mongodb.com/manual/reference/method/db.collection.insert/index.html|MongoDB shell implementation]]. It is functionally identical to [[mongodrv-col-insertMany|insertMany()]], but takes a list of documents (varargs) instead of an array. It also does not support options.
[[[@cG
<collection>.insert(<document>[, ...])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <document> | | A BSON document to insert into the collection. |
]]]
**Example**
[[[@cw
db.employees.insert({ 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]]
|