[CSHARP-2264] Find missing support for .min() and .max() Created: 05/May/18 Updated: 26/Nov/18 Resolved: 26/Nov/18 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | 2.6.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Adam Milazzo | Assignee: | Jeffrey Yemin |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
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
|
| Comments |
| Comment by Jeffrey Yemin [ 26/Nov/18 ] |
|
admilazz you can specify $min and $max fields in FindOptions.Modifiers. Making it more straightforward is the goal of |
| Comment by Adam Milazzo [ 05/Aug/18 ] |
|
Created pull request: https://github.com/mongodb/mongo-csharp-driver/pull/335 |
| Comment by Adam Milazzo [ 05/Aug/18 ] |
|
Also affects 2.7.0. |