Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Atlas Search
Created by Guest
Created on Mar 8, 2022

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 } ```