$cmp Operator in MongoDB
$cmp operator in MongoDB is one of the comparison expression operators. It is used in the aggregation pipeline stages.
The $cmp operator compares both value and type, using the specified BSON comparison order for values of different types.
MongoDB $cmp Operator
The MongoDB $cmp operator compares two values or types and returns a result based on the comparison. It returns 1 if the first value is greater than the second, -1 if the first value is less than the second, and 0 if both values are equal.
Contact Us