Scalar-Equality Clause (Reference)

A scalar-equality clause tests whether a given object field is equal to a given scalar value.

A scalar-equality clause is an object member with a scalar value. It tests whether the value of the field is equal to the scalar.

field : scalar

(Reminder: a JSON scalar is a value other than an object or an array; that is, it is a JSON number, string, true, false, or null.)

A scalar-equality clause is equivalent in behavior to a field-condition clause with a comparison clause that tests the same field value using operator $eq. That is, field : scalar is equivalent to field : { "$eq" : scalar }.

Though the behavior is equivalent, a scalar-equality clause cannot be used in some contexts where the corresponding "$eq" : field member can be used. For example, a scalar-equality clause cannot be used in a not clause. The array elements in the argument array of a not clause must be comparison clauses.