This is not something that we presently support as nearsphere is actually a feature of MongoDB and not of the kinvey platform. You can read more about the implementation / limitations of MongoDB's nearsphere over here: http://docs.mongodb.org/manual/reference/operator/query/nearSphere/#behavior
Some people who have run into issues have opted to use within instead (http://docs.mongodb.org/v2.2/reference/operator/query/within/) , which again, has it's own set of issues to work through.
Thanks,
Mark Thien
said
about 6 years ago
Hi Damien,
Thanks a lot for your answer. Do you recommend any other api service that can return distance ?
Cheerios,
Mark
Damien Bell
said
about 6 years ago
markthien,
You can do it right within mongo, it's just not the most pretty stuff ever...
Mark Thien
I am using Android Kinvey and my collection has a field _geoloc that for querying people around me. Below are the code to query
Query q2 = new Query();
q2.nearSphere("_geoloc", location.getLatitude(), location.getLongitude(), 50);
AsyncAppData findNearByPeople = mKinveyClient().appData("userdata", UserData.class);
findNearByPeople.get(q2, new KinveyListCallback() {
@Override
public void onSuccess(UserData[] result) {
}
@Override
public void onFailure(Throwable error) {
}
});
How does kinvey or will kinvey return the distance as I need to sort my result by distance.
Appreciate any help please. Thanks !
Cheerios,
Mark Thien