Home > Software design >  Is there a way to read one document at a time using react?
Is there a way to read one document at a time using react?

Time:12-22

I'm currently using this hook:

const [Resources, ResourcesLoading] = useCollectionData(collection(firestore, "my-collection"));

however, I have around 1000 documents in there, is there a way to read one document at a time with firebase? I don't want to reach the end of the free tier. I need all the ID's or to have some sort of way to get one document at a time, something like a requestNextDocument() function or hook.

CodePudding user response:

The only way to perform a query without fetching all of the documents at once is to use pagination. You can use limit(1) if you want to make a decision about each document before fetching the next one.

  • Related