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

240
Views
How to limit query from the end. Firestore
const messagesRef = collection(db, 'messages')
const q = query(messagesRef, orderBy('createdAt', 'asc'), limit(25))

Im querying documents in 'messages' collection by creation time, the problem with this is that when im trying to limit documents, it limits from the start, but i want to limit it from the end. I want that user would see newer messages but not the old ones.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

To get the last 25 items, use limitToLast(25) instead of limit(25). While that function isn't mentioned in the guide on limiting data, you can find it in the reference documentation.

about 4 years ago · Santiago Trujillo 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!