[SERVER-40270] Distinct command no longer supports $comment Created: 22/Mar/19 Updated: 27/Oct/23 Resolved: 26/Mar/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Shane Harvey | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
|
| Comments |
| Comment by Shane Harvey [ 26/Mar/19 ] | ||||||||||||||||||||||
|
Thank you david.storch. I've changed PyMongo to send "comment" instead of "$comment" in
That's okay because users must upgrade their drivers before upgrading the server. Upgrading to PyMongo >=3.8 (to be released soon) will fix the issue:
| ||||||||||||||||||||||
| Comment by David Storch [ 26/Mar/19 ] | ||||||||||||||||||||||
|
shane.harvey, the distinct command historically had a loose parser which accepted but ignored any unknown field names. This is why $comment used to work for distinct in addition to comment. Nick's work for That said, our intention going forward is to make sure that all commands support comment, the non-$-prefixed variant, as a top-level command parameter. This work is tracked by
Hopefully that helps to clarify! | ||||||||||||||||||||||
| Comment by Shane Harvey [ 22/Mar/19 ] | ||||||||||||||||||||||
|
I did a deep dive in the server history and found that:
So PyMongo has been sending $comment since 2.6 and assumed it worked correctly because the field happens to also show up in the system.profile collection. I think we should fix PyMongo to send "comment" instead of "$comment". I do have one question: since both "comment" and "$comment" (or any arbitrary field name) are present in the server logs and in system.profile, what is the difference between the two? | ||||||||||||||||||||||
| Comment by Shane Harvey [ 22/Mar/19 ] | ||||||||||||||||||||||
|
Oh that's very interesting. Pymongo has been sending '$comment' with distinct since PyMongo 2.7 which added support for MongoDB 2.6. Do you know if $comment is also ignored on MongoDB 2.6? | ||||||||||||||||||||||
| Comment by David Storch [ 22/Mar/19 ] | ||||||||||||||||||||||
|
Why do we believe that $comment is the right spelling? The name of the generic command parameter elsewhere for comment is just comment, with no dollar-prefixing. Are we sure this isn't a bug in the driver test? | ||||||||||||||||||||||
| Comment by Nicholas Zolnierz [ 22/Mar/19 ] | ||||||||||||||||||||||
|
Thanks for catching this, Shane. I took a cursory look and it appears that the previous distinct parser handled 'comment' but not '$comment', and so I kept the same behavior as part of Hopefully this is just a matter of changing the comment field name in the IDL. |