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
$cmp
is a comparison operator in MongoDB used to compare two values and return the result of the comparison. -
$eq
The Mongodb$eq
operator is used to match documents that are equal to a specified value. -
$exists
$exists
is a query operator in MongoDB that is used to determine whether a specified field exists in a document. -
$gt
The MongoDB$gt
operator is used to compare whether the value of a field is greater than a specified value. -
$gte
The$gte
operator in MongoDB is used to compare whether the value of a field is greater than or equal to a specified constant value. -
$in
The$in
operator is a query operator in MongoDB that matches multiple values during a query. -
$lt
In MongoDB, the$lt
operator is used to query documents where a field is less than a certain value. -
$lte
The$lte
operator can be used for fields of type number, date, and string. -
$ne
In MongoDB, the$ne
operator is used to query documents that are not equal to the specified value. -
$nin
The$nin
operator in MongoDB is used to find documents in the MongoDB database that do not match a specified condition. -
$type
The MongoDB$type
operator is used to return the data type of a document field.