Jerin
Jerin

Reputation: 801

Check for multiple Document Id in Firestore | Flutter

Consider I have a list of String ["id1", "id2", "id3", ...] Is there any way to check if these IDs are present in firestore db without a for loop.

And is it worthy of checking each ID at a time(considering the list.length > 10,000)?

Upvotes: 0

Views: 74

Answers (2)

user14605727
user14605727

Reputation:

I too agree with @Doug Stevenson's answer. Also you could try to write a server side function and then use that function to do the same. This will make the server work for you and will be much faster

Upvotes: 0

Doug Stevenson
Doug Stevenson

Reputation: 317712

If you want to check if a document exists, you have to read it with get() and check the result. If you have 10,000 documents to check, you will need to do this 10,000 times. There is no operation for checking the existence of multiple documents.

Upvotes: 3

Related Questions