| |
read source history
= insertOne() =
----
[[MongoDB Driver Function Reference]]
Inserts a single document into a collection.
More information can be found in the corresponding entry of the [[https://docs.mongodb.com/manual/reference/method/db.collection.insertOne/index.html|MongoDB Manual]].
[[[@cG
<collection>.insertOne(<document>[, <options>])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <document> | | The BSON document to insert into the collection. |
| <options> | | A BOSN document specifying options. |
]]]
**Options**
[[[@cw
{ bypassDocumentValidation: <boolean> }
<<@f:text>>
|@t0@r0@c0 bypassDocumentValidation | | Document validation will be bypassed (default; false). |
<<@/f>>
]]]
**Example**
[[[@cw
db.employees.insertOne({ name: "King", firstname: "Arthur", age: 34, salary: 780000 });
]]]
Inserts a document into the employees collection.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|