Comparison Operators
These operators allow to match based on a fields value relative to some other value.
📌 $gt, $lt
db.movieDetails.find({“runtime”: {$gt: 90, $lt: 120}})You can also add more than one filter.
db.movieDetails.find({“runtime”: {$gt: 90, $lt: 120}, “tomato.meter”: {$gte: 95}})📌 $ne
Values that are not equal to some specific value.
db.movieDetails.find({“rated”: {$ne: “UNRATED”}})📌 $in
Allows to specify one or more values. This filter will look to match any value that is defined in the array value.
db.movieDetails.find({“rated”: {$in: [“G”, “PG”]}})$nin does the opposite operation to $in
Last updated
Was this helpful?