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
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?
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
],...
}
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)
Most helpful comment
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)