Skip to content
Advertisement

Is there a way to get all data from a firestore database using useCollectionData()?

I have a React project and in it I have the following code: (using this react hook for firebase)

JavaScript

Instead of this, I don’t want the query to be ordered or have a limit, is there a way to make an “empty” query to get all the data from a certain collection?

Advertisement

Answer

If you pass messagesRef instead of a query with orderBy() and limit() then the query should fetch all documents in the collection since a CollectionReference is a subclass of a Query:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement