{
"places": {
"<push-key>": {
"name": "Company X"
},
"<push-key>": {
"name": "Restaurant Y"
}
}
"stamps": {
"<push-key>": {
"value": 0,
"date": 1487344650456
}
},
"placeStamps": {
"<place-push-key>": {
"<stamp-push-key-1>": true,
"<stamp-push-key-2>": true,
"<stamp-push-key-3>": true
}
}
}
We are new to Firebase and we were wondering if there was a way to sort our stamps (node in the database) by date. Our flow goes as following:
- We retrieve the place that we want, using the places node.
- With the key of the place we retrieve the stamp keys from the placeStamps/ node.
- Then we retrieve the stamps one-by-one from the stamps node.
Is there a way to sort/filter these objects by for example the ‘date’ or ‘value’? We can’t do it client-side, because we are talking about millions of stamps.
To query the stamps since 24 hours ago:
If you want to retrieve the stamps for a certain place by timestamp, you have two options:
add the timestamp to the stamp key for each place:
Now you can get the stamps for a place by timestamp with: