$eq (aggregation)
On this page
Definition
-
$eq
-
Compares two values and returns:
true
when the values are equivalent.false
when the values are not equivalent.
The
$eq
compares both value and type, using the specified BSON comparison order for values of different types.$eq
has the following syntax:The arguments can be any valid expression. For more information on expressions, see Expressions.
Example
Consider an inventory
collection with the following documents:
The following operation uses the $eq
operator to determine if qty
equals 250
:
The operation returns the following results: