Pratik Mondal
Pratik Mondal

Reputation: 31

How to fetch only latest specific data from Firebase?

Firebase Database snapshot

Please see the attached image. As you see there 8 are tables. How can I fetch the latest user-entered data? I can fetch all data from one table but hows its possible to get only the latest entered data from the table individually ?**

Upvotes: 0

Views: 282

Answers (1)

Alex Mamo
Alex Mamo

Reputation: 138814

to get only the latest entered data from the table individually?

Simply by adding a Timestamp field under each object, ordering the results descending and finally passing 1 as a parameter to Query's limitToFirst(int limit) method.

Upvotes: 2

Related Questions