0

I am trying to query for some users, who are within a radius to a given point, or they fulfill some other requirements. For this, I need to OR two queries:

var notOnlyLocal = new Parse.Query(Parse.User);
notOnlyLocal.equalTo('onlyLocal', false);
notOnlyLocal.equalTo('regions', someSelectedRegions);

var onlyLocal = new Parse.Query(Parse.User);
onlyLocal.equalTo('onlyLocal', true);
onlyLocal.withinMiles('location', geoPoint, 100);

return Parse.Query.or(notOnlyLocal, onlyLocal);

And a great answer comes from Parse:

{
    "code": 141,
    "error": "{\"code\":102,\"message\":\"geo query within or is not supported\"}"
}

Is there a work-around for this kind of situations? There is nothing about this in the documentations. In the caveats they say that an object might contain only 1 location, the near() function limits result to 100 miles radius and points should not equal or exceed the extreme ends of the ranges.

Is there anyone who tried to do something similar, and succeeded? Or any tip for a good work-around?

1 Answer 1

2

You can't use this query with "or" statement. You will need to run these as 2 separate queries and then combine the result sets yourself. First execute the notOnlyLocal query and then filter the results by withinMiles clausole

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

3 Comments

that would be a possibility, but it would double the response time. this is why I tried to OR these queries. And since there is nothing about this in parse documentation, I don't understand why I get this error. Still looking for a workaround
I really tried quite a few possible solutions now, and it seems that Parse wouldn't let me do anything beside the two separate queries. It seems the only solution. Hope they will allow OR-ing the geo query as well
Yes, in according with you is not the best solution, but actually is the unique solution! :(

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.