Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2264

Find missing support for .min() and .max()

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: API
    • None
    • Fully Compatible

      As far as I can tell, there is no easy way to execute a command like db.collection.find().min(lbound).max(ubound). Since I need those, I'm forced to choose between executing the "find" command manually with RunCommand() (and then deal with parsing the response, managing the cursor, and deserializing the results myself) or maintaining a custom version of the driver.

      Please add support for the missing .min() and .max() functions. I suggest syntax like:

      collection.Find(...).Min(lbound).Max(ubound) to maintain parity with mongoDB,

      or

      collection.Find(...).Bound(lbound, ubound) to avoid potential confusion with min/max aggregates,

      or, if you think they're too obscure to belong on the fluent interface, they could be added to FilterOptionsBase.

      I'll note that min() and max() are not equivalent to (and can't be replaced by) a corresponding range filter on the index key because the filter is subject to type bracketing while min() and max() are not.

      See:

      https://docs.mongodb.com/manual/reference/method/cursor.min/index.html

      https://docs.mongodb.com/manual/reference/method/cursor.max/index.html

       

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            admilazz Adam Milazzo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: