Filters

Filter system, use to filter results

Property
Description
Type usage

$gt

is greater than

$gte

is greater than or equal to

$lt

is less than

$lte

is less than or equal to

$eq

is equal to

$ne

is not equal to

$in

is included in

$nin

is not included in

$exists

is defined

Any

$regex

is a regular expression

$limit

Limit how much data will come out in the result

To use, just create an object, its key will be the value that we will apply the filters

<key>: { $filter: value }

Teacher.find({
  age: {
    $gte: 20
  },
  score: {
    $gte: 5
  }
})

Output

Reference with filter

The filter can be applied inside finds with references

Full example

Last updated

Was this helpful?