0

Is there a way to query by array length in Parse? i.e. I want to get all the objects where the array length > 2 or something like that.

Thanks!

1
  • You will have to give more details. As it is it isn't really possible to comment because we have no context. Commented Apr 16, 2015 at 21:51

1 Answer 1

4

There is no direct way to do that. But what you could do is, adding another row which you use as a counter. Check the beforeSave documentation for that. For example everytime you add elements to the array, you increase the counter. Than you could check the size like that:

//Shows all items where the arraySize is bigger than 10
yourQuery.whereKey("arraySize", greaterThan: 10)
Sign up to request clarification or add additional context in comments.

1 Comment

@Wain Thx. I've added that to my answer.

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.