Unfortunately, Firebase doesn\'t have out of the box an aging mechanism (delete old entries automatically). So, I am trying to implement one. However, I am stuck between two dec
Deleting outdated items from the client has been covered before. See:
To secure this operation so that only outdated items can be removed, you can use Firebase Database security rules. Something like:
{
"rules": {
"messages": {
"$message": {
// only messages older than an hours can be remove
".write": "newData.exists() || data.child('timestamp').val() < (now - 3600000)",
}
}
}
}
Running your own code on Firebase's servers can now be done with Cloud Functions for Firebase. There is also a sample that shows how to delete older data with Cloud Functions.