Search Operators
Query Selectors
- $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.
- $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.
- $inMatches any of the values specified in an array.
- $ninMatches none of the values specified in an array.
Logical
- $orJoins query clauses with a logical OR returns all documents that match the conditions of either clause.
- $andJoins query clauses with a logical AND returns all documents that match the conditions of both clauses.
- $notInverts the effect of a query expression and returns documents that do not match the query expression.
- $norJoins query clauses with a logical NOR returns all documents that fail to match both clauses.
Element
- $existsMatches documents that have the specified field.
- $typeSelects documents if a field is of the specified type.
Evaluation
- $modPerforms a modulo operation on the value of a field and selects documents with a specified result.
- $regexSelects documents where values match a specified regular expression.
##Array
- $allMatches arrays that contain all elements specified in the query.
- $elemMatchSelects documents if element in the array field matches all the specified- $elemMatchconditions.
- $sizeSelects documents if the array field is a specified size.
Example
{
  "qty": { "$gt": 0 }, // for quantities greater than zero
  "discontinued": 0, // and not discontinued
  "$or": [
    { "description": { "$regex": "new" } }, // that has the word "new" in it
    { "description": { "$regex": "hot" } } // that has the word "hot" in it
  ]
}
tip
For matching operators with MongoDB you can read more here