Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
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)

const messagesRef = firestore.collection('messages');
const query = messagesRef.orederBy('createdAt').limit(25);
const [messages] = useCollectionData(query, {idField: 'id'});

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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:

const messagesRef = firestore.collection('messages');
const [messages] = useCollectionData(messagesRef, {idField: 'id'});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!