| |
read source history
= deleteOne() =
----
[[MongoDB Driver Function Reference]]
Deletes the first document from a collection that meets the filter criteria.
More information can be found in the corresponding entry of the [[https://docs.mongodb.com/manual/reference/method/db.collection.deleteOne/index.html|MongoDB Manual]].
[[[@cG
<collection>.deleteOne(<filter>[, <options>])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <filter> | | A filter expression using [[https://docs.mongodb.com/manual/reference/operator/|query operators]]. |
| <options> | | A BOSN document specifying options. |
]]]
**Options**
[[[@cw
{ collation: <document>, hint: <document> }
<<@f:text>>
|@t0@r0@c0 collation| | A document specifying the [[https://docs.mongodb.com/manual/reference/bson-type-comparison-order/#collation|collation]]. |
| hint | | A document specifying a [[https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany/#ex-deletemany-hint|hint]]. |
<<@/f>>
]]]
**Example**
[[[@cw
db.employees.deleteOne({ salary: { $gt: 700000 }});
]]]
Deletes one document from the employee collection with a salary greater than 700000.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|