Geo Location

Does the logo search support the $near or the $nearsphere query operators?

I need to find all users within a 25 mile (or KM) radius of a point.

Hi,

The answer is yes, but… 

Lua and JavaScript(JSON) have a real big issue on how to handle arrays and objects as they become deeply nested. I’ve been trying every which way to come up with a query that will make is through the conversion, but no luck yet.

I’m looking at adding a method to be able to push a “raw” JSON string, which should make it through the process. Of course that’s on a list of a number of things.

Will post again here if and when an update occurs in this area.

Cheers.

Ok Thanks, any help is appreciated, my aim is to move from Parse as soon as possible and I would really like to move to coronium, so I’m exploring all the items that I need to make sure I can, we created an app to order Security (Uber for Security type App) with Corona and Parse  https://itunes.apple.com/us/app/suitz/id1084865280?mt=8 and it’s starting to gain traction but obviously I need to move the backend.

The closest I got with the query was it returned:

$err: $near requires a point, given { type: “point”, coordinates: [null, -118.2749409, 33.9327136] }

 

It looks like it gave an extra parameter to the coordinates

Hi,

You are correct about the “additional” item, and this is because Lua indexes start at 1, and of course everyone else starts at 0. So this adds a need for some type of value at index 0, which is generally a JSON ‘null’, but this is handled by the driver, so I have little control.

But, even beyond that, the driver is converting nested table arrays as strings and not JavaScript arrays, so what Mongo server wants is:

[lua]

[“val1”, “val2”]

[/lua] 

But it ends up being converted by the driver to:

[lua]

“[“val1”, “val2”]”

[/lua]

Which is not a valid JavaScript array. It’s now a string.

Again, a method to send a raw JSON string may be the only workaround.

Cheers.

yes I can see how the JSON index can cause a problem, if you have to send raw json then I think that will be fine, as long as it consistently works and the documentation is clear :slight_smile:

Is there anyway to use the PHP to run a query on the mongo database, or even create a JavaScript module so that any JavaScript can be run if needed, I’m not sure you can do a total Lua solution for everything ( but I’ve been known to be wrong :slight_smile: )

Hi Cublah/Everyone,

Sorry to bring up an older post but having the same requirement (search for users within a set area) and seeing if anyone got this solved?

Would running a ‘coronium.user.getUsers()’ with query of lat/long coords object be suitable? I’m not sure how to integrate the $near or $nearsphere query operators except possibly with 'mongo:getObjects() and passing something like '{ $nearSphere : [X , Y] $maxDistance : 10 }. Is this the right concept?

Anything anyone could share would be most grateful

Thanks in advance

Hi,

The answer is yes, but… 

Lua and JavaScript(JSON) have a real big issue on how to handle arrays and objects as they become deeply nested. I’ve been trying every which way to come up with a query that will make is through the conversion, but no luck yet.

I’m looking at adding a method to be able to push a “raw” JSON string, which should make it through the process. Of course that’s on a list of a number of things.

Will post again here if and when an update occurs in this area.

Cheers.

Ok Thanks, any help is appreciated, my aim is to move from Parse as soon as possible and I would really like to move to coronium, so I’m exploring all the items that I need to make sure I can, we created an app to order Security (Uber for Security type App) with Corona and Parse  https://itunes.apple.com/us/app/suitz/id1084865280?mt=8 and it’s starting to gain traction but obviously I need to move the backend.

The closest I got with the query was it returned:

$err: $near requires a point, given { type: “point”, coordinates: [null, -118.2749409, 33.9327136] }

 

It looks like it gave an extra parameter to the coordinates

Hi,

You are correct about the “additional” item, and this is because Lua indexes start at 1, and of course everyone else starts at 0. So this adds a need for some type of value at index 0, which is generally a JSON ‘null’, but this is handled by the driver, so I have little control.

But, even beyond that, the driver is converting nested table arrays as strings and not JavaScript arrays, so what Mongo server wants is:

[lua]

[“val1”, “val2”]

[/lua] 

But it ends up being converted by the driver to:

[lua]

“[“val1”, “val2”]”

[/lua]

Which is not a valid JavaScript array. It’s now a string.

Again, a method to send a raw JSON string may be the only workaround.

Cheers.

yes I can see how the JSON index can cause a problem, if you have to send raw json then I think that will be fine, as long as it consistently works and the documentation is clear :slight_smile:

Is there anyway to use the PHP to run a query on the mongo database, or even create a JavaScript module so that any JavaScript can be run if needed, I’m not sure you can do a total Lua solution for everything ( but I’ve been known to be wrong :slight_smile: )

The ability to push Javascript code is part of the new release (still in progress). More info this week.

Cheers.

Thanks Develephant!

Looking forward to the new details

Hi Cublah/Everyone,

Sorry to bring up an older post but having the same requirement (search for users within a set area) and seeing if anyone got this solved?

Would running a ‘coronium.user.getUsers()’ with query of lat/long coords object be suitable? I’m not sure how to integrate the $near or $nearsphere query operators except possibly with 'mongo:getObjects() and passing something like '{ $nearSphere : [X , Y] $maxDistance : 10 }. Is this the right concept?

Anything anyone could share would be most grateful

Thanks in advance

The ability to push Javascript code is part of the new release (still in progress). More info this week.

Cheers.

Thanks Develephant!

Looking forward to the new details