mongo geo index internal query

67 views
Skip to first unread message

Raxit Sheth

unread,
Nov 17, 2012, 2:28:44 AM11/17/12
to mongod...@googlegroups.com
Hi

When we use 2d/geo index, mongodb internally storing like this
(long,lat)/(x,y)-->geo-hash--->store geohash


When we retrive ($near query) :
convert given (long,lat),(x,y)
geohash
find distance accuracy required and strip remaining char from right
hand side of geo-hash
find 8 bounding box
Use 2d index on geohash (which is same as regular index, but geohash???)

Query :
index on geohash vs index on regular string has any difference in mongodb?


Purpose of query :
we want to put our on geo-retrival based on regular index by storing
geohash (simulating mongodb geo-index) as we need 2d index on more
than 2 field + $elemMatch with $near , both of which is currently not
possible.



Thanks
Raxit Sheth

Raxit Sheth <Mobile 4 Mumbai>

unread,
Nov 19, 2012, 8:36:18 PM11/19/12
to mongodb-user

Max Schireson

unread,
Nov 20, 2012, 3:53:22 AM11/20/12
to mongod...@googlegroups.com

I'm not 100% sure I understand the question.

I think you are asking about using indexes on strings where the content of the string is itself a geohash. It appears that you'd like to do a $ near query on the strings combined with some other queries.

I think what you are trying to do is not supported in mongodb.

Let me know if I misunderstood what you're asking.

-- Max

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Raxit Sheth <Mobile 4 Mumbai>

unread,
Nov 20, 2012, 10:12:06 PM11/20/12
to mongodb-user
Max

what we want to do is, instead of using $near of mongo, want to
write our own $near
Instead of using "2d" index which is essentially B-Tree index on
geohash, want to write our own implementation @ App level


Raxit
On Nov 20, 1:53 pm, Max Schireson <mschire...@gmail.com> wrote:
> I'm not 100% sure I understand the question.
>
> I think you are asking about using indexes on strings where the content of
> the string is itself a geohash. It appears that you'd like to do a $ near
> query on the strings combined with some other queries.
>
> I think what you are trying to do is not supported in mongodb.
>
> Let me know if I misunderstood what you're asking.
>
> -- Max

Max Schireson

unread,
Nov 20, 2012, 11:14:19 PM11/20/12
to mongod...@googlegroups.com

I've seen app level geo indexing built on top of non-geo indexes before with other technologies. No reason off the top of my head it won't work if done properly but it will be a lot of work...

-- Max

Raxit Sheth <Mobile 4 Mumbai>

unread,
Nov 21, 2012, 3:37:59 AM11/21/12
to mongodb-user
Thanks!

Just finished implementing small hack for our app with Python.
Hope to see more advanced geo 2d&haystack in new version of mongo,
soon!

Raxit

Max Schireson

unread,
Nov 21, 2012, 10:59:38 AM11/21/12
to mongod...@googlegroups.com

Working on more geo, stay tuned!

Reply all
Reply to author
Forward
0 new messages