I am following the documentation to setup rules. It's a simple chat app and I want to retrieve only the recent messages (i.e. messages that were created in the last X mins). I found the following document and tried exactly the same thing.
Structure
Rules
{
"rules": {
"messages": {
"$message": {
".read": "data.child('timestamp').val() > 1" // try allowing everything
}
},
".write": true
}
}
It looks like none of the messages are retrieved. As a workaround for this, I'm doing it on the client-side like this:
messagesRef.orderByChild('timestamp')
.startAt(Date.now() - 600000)
.on('child_added', (data) => {
// do something
})
Hopefully someone can help me out with the rules!