0

I want to load the details based on the user location. When I query for the results it is always returning empty array. What to do? This is my query:

https://api.parse.com/1/classes/TSLocation?where{"location":"{\"nearSphere\":{\"__type\":\"GeoPoint\",\"latitude\":34.944251,\"longitude\":-111.753343}}","limit":10}

I have also added the headers along with the HttpRequest. Can you please guide if anybody knows

2 Answers 2

2

Finally I got it..actually my query was wrong.In the above query at location i am passing JsonString instead of JSONObject.

Formatted Query is: https://api.parse.com/1/classes/TSLocation?where={"location":{"$nearSphere":{"__type":"GeoPoint","longitude":-74.00594130000002,"latitude":40.7127837}}}&limit=10

Sign up to request clarification or add additional context in comments.

Comments

0

It is $nearSphere not nearSphere, try this

https://api.parse.com/1/classes/TSLocation?where{"location":"{\"$nearSphere\":{\"__type\":\"GeoPoint\",\"latitude\":34.944251,\"longitude\":-111.753343}}"}&limit=10

6 Comments

Yeah.. I have changed it and query executed successfully.. but the above query is returning 100 rows from TSLocation table,my intent is to fetch 10 records at a time..Although I have included limit condition but it os not working..Can you please tell me
Limit is a separate query string parameter check the updated answer.
Thanks @sarvesh ..Limit is working..The above query is executing but results are not accurate I think where condition is not working Is that the above query Correct?(i.e.,where or where=). If I didnot mention =operator results will come (which are not satisifed the condition),If I mention the =operator results are returned with an empty array. Can you please tellme..I have been searching since 2 days....
You statements are contradictory, you said the query worked and then it doesn't. Are you sure you didn't change something. You were getting 100 records and wanted 10 right?
Sorry If I were wrong..limit condition is working(i.e. It is returning the results based on the limit I gave).What I want to achieve is I need to fetch 10results based on the user location.If I execute the above condition with lat and long values It is returning the results, although I gave wrong co ordinates also it is returning the same results.This is my problem.Can you please tell me.How to achieve this.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.