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
}
