[SERVER-19907] Distinct command should accept a BSON element of type null for the "query" field Created: 12/Aug/15 Updated: 19/Sep/15 Resolved: 02/Sep/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.1.7 |
| Fix Version/s: | 3.1.8 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Craig Wilson | Assignee: | YunHe Wang |
| Resolution: | Done | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||
| Steps To Reproduce: | with 3.1.6, start a shell:
with 3.1.7, start a shell:
|
||||||||||||||||||
| Sprint: | Quint 9 09/18/15 | ||||||||||||||||||
| Participants: | |||||||||||||||||||
| Description |
|
The distinct command used to accept a null query parameter (up through 3.1.6), but the latest nightly (3.1.7) raises an error. This will be a backwards breaking change for any user/driver that was sending a null query. |
| Comments |
| Comment by Githook User [ 02/Sep/15 ] | ||||||
|
Author: {u'name': u'Yunhe (John) Wang', u'email': u'yunhe.wang@mongodb.com'}Message: Closes #1013 Signed-off-by: David Storch <david.storch@10gen.com> | ||||||
| Comment by J Rassi [ 12/Aug/15 ] | ||||||
|
Thanks. The existence of an official driver with this behavior seems like a good enough reason to me to provide a backwards-compatibility fix for this issue, although I'd like to see the driver fixed as well. Craig, can you please file a ticket to fix the .NET driver to omit the "query" field from the distinct command object if the user does not provide a query predicate, and link the ticket here? | ||||||
| Comment by Craig Wilson [ 12/Aug/15 ] | ||||||
|
I know the .NET driver is failing some tests. They are all 1 specific path through the old LINQ provider, so any user with code like this will get the failure:
I don't know of any other drivers that would be doing this without user intervention as none other is translating queries like this. I also don't know how many others would actively prevent null from being sent intentionally when provided by a user. | ||||||
| Comment by J Rassi [ 12/Aug/15 ] | ||||||
|
Craig, what existing drivers do you know of that will issue a distinct operation to the server with a null value for "query", if the user hasn't explicitly asked for such a value? | ||||||
| Comment by Craig Wilson [ 12/Aug/15 ] | ||||||
|
We can certainly change future drivers to not pass null, but any existing driver that is currently doing this under whatever scenario will break. Not to mention any user code running the command through the generic run command interface in any driver. | ||||||
| Comment by David Storch [ 12/Aug/15 ] | ||||||
|
We introduced additional validation to the distinct command parameters in https://github.com/mongodb/mongo/commit/bc4572c985a6d9dca5721ec45e88a19061f3842e under
This simplified the parsing code, and also is consistent with the documentation of the distinct command (http://docs.mongodb.org/manual/reference/command/distinct/). However, if existing drivers rely on passing a BSON element of type null for the "query" field, we may have to relax the validation. |