Details
-
Task
-
Resolution: Incomplete
-
Minor - P4
-
None
-
None
-
None
-
None
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(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> 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(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.insert(
)
> db.test.distinct('value');
[ "blah", "FOO", "BAR", "bar", "foo" ]
>