[SERVER-12524] Distinct: Empty query on hashed index returns bad result Created: 29/Jan/14  Updated: 11/Jul/16  Resolved: 05/Feb/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Result from distinct for empty query with a hashed index is incorrect:

> t.distinct('a', {})
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
> t.ensureIndex(

{a: "hashed"}

);
> t.distinct('a', {})
[
NumberLong("-6504342592125989714"),
NumberLong("-6200100076853976706"),
NumberLong("-1529429926180645992"),
NumberLong("848411777775835583"),
NumberLong("2433984061343616404"),
NumberLong("4470791281878691347"),
NumberLong("4854801880128277513"),
NumberLong("5902408780260971510"),
NumberLong("6497670140411665948"),
NumberLong("9174449368162552349")
]
> t.distinct('a',

{a: 3}

)
[ 3 ]



 Comments   
Comment by Githook User [ 05/Feb/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-12524 distinct solution for empty query cannot use a special index.
Branch: master
https://github.com/mongodb/mongo/commit/00f1db0d025aef71c91af00672f1bcc0110f3483

Generated at Thu Feb 08 03:28:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.