MongoDB Comparison Operators
MongoDB comparison operators are a set of special operators used to perform comparison operations, including equality, inequality, greater than, less than, greater than or equal to, and less than or equal to. They can be used for conditional filtering in both aggregate and normal queries. This page summarizes the comparison operators in MongoDB.
-
$cmp
$cmpis a comparison operator in MongoDB used to compare two values and return the result of the comparison. -
$eq
The Mongodb$eqoperator is used to match documents that are equal to a specified value. -
$exists
$existsis a query operator in MongoDB that is used to determine whether a specified field exists in a document. -
$gt
The MongoDB$gtoperator is used to compare whether the value of a field is greater than a specified value. -
$gte
The$gteoperator in MongoDB is used to compare whether the value of a field is greater than or equal to a specified constant value. -
$in
The$inoperator is a query operator in MongoDB that matches multiple values during a query. -
$lt
In MongoDB, the$ltoperator is used to query documents where a field is less than a certain value. -
$lte
The$lteoperator can be used for fields of type number, date, and string. -
$ne
In MongoDB, the$neoperator is used to query documents that are not equal to the specified value. -
$nin
The$ninoperator in MongoDB is used to find documents in the MongoDB database that do not match a specified condition. -
$type
The MongoDB$typeoperator is used to return the data type of a document field.