[SERVER-35922] listCollections can't filter on collection options when using nameOnly Created: 29/Jun/18 Updated: 06/Dec/22 Resolved: 13/Jul/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | 4.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | David Golden | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | nyc | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||||||||||||||
| Assigned Teams: |
Storage Execution
|
|||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
|||||||||||||||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||||||||||||||
| Description |
|
When using listCollections with the nameOnly option and a filter, it looks like the filter is applied after retrieving only name information. The documentation isn't clear that this is what should occur and the behavior could be surprising to users. Another possible improvement would be to have the command fail if nameOnly is true and the filter contains any keys other than name. |
| Comments |
| Comment by David Golden [ 06/Jul/18 ] |
|
I think it's clearest to say "nameOnly" means you get to search on name only, regardless of the capabilities of the underlying command. |
| Comment by Eric Milkie [ 06/Jul/18 ] |
|
During our discussion it was pointed out that it might be hard to determine which filters apply with nameOnly, since the filter is a Match Expression, which can include operators. Additionally, since nameOnly belies its name and returns not only collection names but also their types, you can also successfully filter on type. |
| Comment by David Golden [ 06/Jul/18 ] |
|
Works for me. I already updated the driver spec to prohibit nameOnly with filters on anything other than name, so I think we're in sync. |
| Comment by Eric Milkie [ 06/Jul/18 ] |
|
Decided to document this behavior and no further changes to the code. |
| Comment by Eric Milkie [ 06/Jul/18 ] |
|
I am leaning towards having the command fail, as the only purpose for using the "nameOnly" option is for efficiency, to avoid taking collection locks. If you want to filter on fields other than the collection name, you'll have to take collection locks anyway. The error message can state that filter with nameOnly can only filter on names and no other fields. |