Skip to content

Geopoint near and withinKilometer internal error #621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ugo-geronimo opened this issue Feb 24, 2016 · 3 comments
Closed

Geopoint near and withinKilometer internal error #621

ugo-geronimo opened this issue Feb 24, 2016 · 3 comments
Labels
type:question Support or code-level question

Comments

@ugo-geronimo
Copy link

Hi,

We have migrated the DB to MongoLab and now this code show an internal error.
var userGeoPoint = new Parse.GeoPoint(latitude, longitude);
var query = new Parse.Query("User");
query.near("location", userGeoPoint);
query.limit(10);
query.find({
success: function(placesObjects) {
console.log("yes");
},
error:function(status) {
console.log(status);
}
});

If I comment the line with the near function or replace it with equalTo, it works without any problem.

Regards,

Ugo

@gfosco
Copy link
Contributor

gfosco commented Feb 26, 2016

Did you make a separate class called "User" or should this be "_User" (the special users class on Parse)... Check the indexes on mongolab and see if there's a 2d index on the location column?

@ugo-geronimo
Copy link
Author

I'm still using the special user class from Parse, I just migrated the db to mongolab.
The data looks ok Mongolab and I can use withinGeoBox without any problem.
{
"_id": "fTTLP4hHUl",
"location": [
2.288544975410035,
48.87132894975191
],...
}

@ghost
Copy link

ghost commented Mar 7, 2016

I also observed "internal error" after migrating my database to mLab. However, the problem was indeed a missing 2d index on the relevant key in the database.

After adding the 2d index via the mLabDB-->Indexes-->Add Index button in mLab UI the query.whereWithinMiles() method began working as expected and returning results instead of the error.

If your result sets are empty then be sure to call e.printStackTrace() in the "done" method of the query callback to confirm if you're encountering this condition.

Note that I added new documents containing geo-spacial data to the database since migration so maybe we need to be sure to create 2d indexes going forward.

Here's a snippet of the exception stack so that this error is searchable for others:

03-06 23:05:03.546: W/System.err(2137): com.parse.ParseRequest$ParseRequestException: internal error
03-06 23:05:03.546: W/System.err(2137): at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:279)
03-06 23:05:03.546: W/System.err(2137): at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:303)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

4 participants