Unfortunately, the REST interface only accepts strings and integers.
Therefore, the array [114.25,22.3] is interpreted as a string, as you
can see in the "query" document:
"query" : { "geoNear" : "mytable", "near" : "[114.25,22.3]" }

An attempt to perform a find operation with $near suffers from the
same issue:
"query" : { "gps" : "{$near:[114, 22]}" }
"{$near:[114, 22]}" is interpreted as a string.

For this reason, the REST interface is unable to run many commands.

There is an outstanding JIRA ticket to improve the REST interface:
SERVER-2030 - "Better REST api query"
Unfortunately it is not scheduled for a specific release version.

Now the good news: There is a third-party REST interface for mongo
called Sleepy.Mongoose, which will run commands.


Once you have Sleepy.Mongoose up and running, you can execute a
geoNear command like so:
$ curl --data 'cmd={"geoNear" : "mytable", "near":[114.25,22.3]}'

Further documentation on how to perform database commands with
Sleepy.Mongoose may be found here:

Hopefully this will be helpful for you.

You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›

2 users in discussion

Jason.Lee: 1 post Marc: 1 post



site design / logo © 2016 Grokbase