[Geo] $elemMatch not working with $near <Jira SERVER-7581 created>

66 views
Skip to first unread message

Raxit Sheth

unread,
Nov 7, 2012, 12:39:41 PM11/7/12
to mongod...@googlegroups.com
Hi


As per mongo doc on geo,  [http://www.mongodb.org/display/DOCS/Geospatial+Indexing] ->Multi-location documents >

db.places.insert({ addresses : [ { name : "Home", loc : [55.5, 42.3] }, { name : "Work", loc : [32.3, 44.2] } ] })

how to find, all records near to address.loc [ 55.5,42.3] and those are tagged as "home" (in same array element)

> db.places.find({"address" : {$elemMatch:{"loc":{$near:[55.5,42.3]},name:"Home"}}})
error: {
"$err" : "can't find special index: 2d for: { address: { $elemMatch: { loc: { $near: [55.5,42.3] }, name: \"Home\" } } }",
"code" : 13038
}



created jira issue here : https://jira.mongodb.org/browse/SERVER-7581

I think Geo is very very restrictive in Mongo, and great if someone can quickly plan fix for it!



Raxit


Raxit Sheth

unread,
Nov 7, 2012, 12:43:54 PM11/7/12
to mongod...@googlegroups.com
Interestingly 

1.  $and with $near is also not working
2.  one can't create 2d/geo index on multiple field

So kind of got stuck !

Raxit
Reply all
Reply to author
Forward
0 new messages