[DOCS-52] Undocumented distinct sorting no longer in 1.8 Created: 24/Mar/11  Updated: 01/Oct/12  Resolved: 01/Oct/12

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: shu zOMG chen Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 11 years, 20 weeks, 2 days ago

 Description   

Apparently there was an undocumented feature of distinct in 1.6 where values would be returned binary sorted. This behavior has disappeared in 1.8.

You could count it as a regression but I see it more of a documentation issue. IMO it'd be better to leave sorting to the client (since binary sorting might not even be the desired behavior) or something to be done explicitly. We were only bitten by this bug because nowhere in the changelog/release notes does it appear to be mentioned that this behavior changed.

====TEST CASE=======
MongoDB shell version: 1.6.5
connecting to: test
> use test;
switched to db test
> db.test.insert(

{'id':1, 'value':'blah'}

)
> db.test.insert(

{'id':2, 'value':'FOO'}

)
> db.test.insert(

{'id':3, 'value':'BAR'}

)
> db.test.insert(

{'id':4, 'value':'bar'}

)
> db.test.insert(

{'id':5, 'value':'foo'}

)
> db.test.distinct('value');
[ "BAR", "FOO", "bar", "blah", "foo" ]
>

MongoDB shell version: 1.8.0
connecting to: test
> use test;
switched to db test
> db.test.insert(

{'id':1, 'value':'blah'}

)
> db.test.insert(

{'id':2, 'value':'FOO'}

)
> db.test.insert(

{'id':3, 'value':'BAR'}

)
> db.test.insert(

{'id':4, 'value':'bar'}

)
> db.test.insert(

{'id':5, 'value':'foo'}

)
> db.test.distinct('value');
[ "blah", "FOO", "BAR", "bar", "foo" ]
>



 Comments   
Comment by Sam Kleinman (Inactive) [ 01/Oct/12 ]

I don't think it makes sense to document behaviors of pre-1.8 MongoDB at this point in the development of the project. Sorry that we didn't get to this sooner.

Generated at Thu Feb 08 07:37:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.