docs
CURD
Delete

Delete

The delete() method is used to removes all documents that match the filter from a collection.

let deleted_result = collection.delete_many(doc!{
    "_id": key,
})?;

Condition

NameDescription
$eqMatches values that are equal to a specified value.
$gtMatches values that are greater than a specified value.
$gteMatches values that are greater than or equal to a specified value.
$inMatches any of the values specified in an array.
$ltMatches values that are less than a specified value.
$lteMatches values that are less than or equal to a specified value.
$neMatches all values that are not equal to a specified value.
$ninMatches none of the values specified in an array.
$regexMatches values that are equal to the given regular expression.

Those conditions are the same listed in the Advanced conditions (opens in a new tab).

Last updated on May 29, 2023