Update
The update() method is used to modify an existing document or documents in a collection.
let collection = db.collection::<Document>("config");
collection.update_many(doc! {
"_id": "c2"
}, doc! {
"$set": doc! {
"value": "c33",
},
})?;Operations
| Name | Description |
|---|---|
| $inc | Increments the value of the field by the specified amount. |
| $min | Only updates the field if the specified value is less than the existing field value. |
| $max | Only updates the field if the specified value is greater than the existing field value. |
| $mul | Multiplies the value of the field by the specified amount. |
| $rename | Renames a field. |
| $set | Sets the value of a field in a document. |
| $unset | Removes the specified field from a document. |