Support min-max computation for number and date fields, within Atlas Search
Currently, the $min
and $max
aggregation operators can be used in a number of aggregation pipeline stages, in order to find min/max values for fields. It would be great if either these operators were supported within $search
, or if there was a way to compute the min-max values for number and date fields within Atlas Search itself. There are certain use-cases where such a functionality can prove useful.
For instance, we can leverage the $near
operator to get sorted results, and determine the sort order of the results based on the origin
. However, many times, the min-max values for the field might not be known beforehand, and thus determining what value of "origin" to use in the query can be challenging. However, if there was a way to compute the min or max of a field within $search itself, then it would really be helpful for those use-cases. If such a functionality were implemented, it could be used in a way that could be something like this:
near": {
"origin": "max" / "min",
"path": "rating",
"pivot": 1
}
![](https://secure.gravatar.com/avatar/356224f6f402fc2aea8106b655c45951?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)