The equals operator should support numeric datatypes
Currently, for querying on "number" datatypes, we can only use "range" or "near" operators. The "equals" operator supports querying only "boolean" and "objectId" values, and not numeric values.
If we want to do equality based matching for number datatypes, then we can leverage "range" using "gt" and "lt" to find it. However this might be sub-optimal in some cases (such as when performing equality match on decimals).
Therefore, this is a feature request for having equals operator support numeric datatypes (in addition to boolean and objectId).
Documentation can be found here
Really good news!
It seems that the documentation for this change is not updated yet. Is this currently available in beta only?
Will this feature support comparisons with numbers in arrays? Few examples below:
1. Does the array field [234, 635, 287] contain 635?
2. Does the array field [234, 635, 287] exactly match [234, 635, 287]?
3. Does the array field [234, 635, 287] match one or more of [234, 635]?
Is there an ETA on this feature?
This feature request would also apply for the "date" datatype, which is currently supported only by the "range" or "near" operators, but not by the "equals" operator.
Yes, we also need this feature. It’s not recommanded to use a $match in a $search query because it can drastically slow down query results (according to the docs).