I'm new to firebase and wanted to ask how I can retrieve only the latest data e.g. the last 5 activities added.
I structured my data the following way: activities have the userID as a key and the timestamp as a subkey, see:
activities
|-uid
|-timestamp
|-data: {}
so for example:
activities
|-4zDhgv1UEjb3EfZ9XhO2PAHdHYg9
|-1621608449507
|-distance: 12.5
|-1621608957090
|-distance: 9.75
I think of some query like this, which of course doesn't work atm
firebase.database.ref(`activities`).SUBLEVEL().orderByValue().limitToLast(5);
Thanks in advance for any help!