[CDRIVER-2027] Add mongoc_collection_find_one_with_opts() Created: 04/Feb/17 Updated: 03/May/17 Resolved: 13/Feb/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Arseny Vakhrushev | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
There is an API called mongoc_gridfs_find_with_opts() which counters mongoc_collection_find_with_opts() for fetching files from a GridFS as opposed to documents from a collection. And there is a useful alternative called mongoc_gridfs_find_one_with_opts() to fetch just one matching file. It seems like a helpful wrapper, and a user legitimately anticipates there is a sibling for a collection, but there's none... As a proposal of a new useful feature and a measure to eliminate API inconsistencies, a new API can be implemented to help fetching one result from a collection much like the aforementioned mongoc_gridfs_find_one_with_opts(). Taking into account the proposed optimizations for mongoc_gridfs_find_one_with_opts(), the new API should be fairly easy to implement. Please refer to: https://jira.mongodb.org/browse/CDRIVER-2026 for details. |
| Comments |
| Comment by Arseny Vakhrushev [ 13/Feb/17 ] |
Likewise, less inconsistency is better than more. Anyways, your world - your rules, Jess! Thanks for your input. |
| Comment by A. Jesse Jiryu Davis [ 13/Feb/17 ] |
|
Thanks Arseny. Since you're the only person to request this in the C Driver's years of life, and since you can simply do "find_with_opts" with limit 1 and singleBatch true, and since a "findone" is not required by the MongoDB CRUD API Spec, we won't implement this. Less code is better than more! |