-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 1.7.3
-
Component/s: Geo, Index Maintenance
-
None
-
Environment:OS X 64-bit, 1.7.3 prebuilt
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
w/1.7.3, distinct() doesn't seem to work with an indexed geo field, though in it does in 1.6.4.
To replicate, run these 3 lines in mongo:
use test_distinct
db.commits.save(
)
db.runCommand(
)
OK, we see one commit. But if the geo field is indexed, we get an exception.
> db.commits.ensureIndex(
{'loc': '2d'})
> db.commits.getIndexes()
[
{
"name" : "id",
"ns" : "test_distinct.commits",
"key" :
,
"v" : 0
},
{
"_id" : ObjectId("4ceadeb04ca1623d1ab8bcf3"),
"ns" : "test_distinct.commits",
"key" :
,
"name" : "loc_"
}
]
> db.runCommand(
)
{
"errmsg" : "exception: best guess plan requested, but scan and order required: query: {} order:
choices:
{ $natural: 1 } ",
"code" : 13284,
"ok" : 0
}
In 1.6.4, this works (same inputs as above)
> db.runCommand(
{distinct: 'commits', key: 'loc'})
{ "values" : [ 13.00156, 55.59664 ], "ok" : 1 }