1

I have an array of UIDs (String) and I want to perform a query using Firestore where I get all the documents in which the field "uid" is equal to any of the ones in the array provided.

Till now I tried doing:

ref.whereField("uid", in: uidArray)

But this doesn't work and gives me an error because the maximum number of elements in the array must be 10 and it surely surpasses that limit.

My question is: how can I achieve the same result with a workaround using Firestore?

Whenever I try to implement a query using this DB it seems it's built for making developers' lives harder.

1

1 Answer 1

1

Yes, according to the docs, the maximum number of elements in the array is 10. To be able to get over this limitation, you should perform successive calls. For example, if you need to check a field against 35 values, then you should perform 4 queries. Three queries with the 10 elements and the fourth with 5 elements. Lastly, you should combine the result on the client.

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

1 Comment

for sure, I will upvote and accept it

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.