My app has bits of information that exist for 24 hrs. This information has the potential to be voted on by other users. The number of votes is recorded in the database. If someone votes on a piece of information, I want it to be updated only if the path currently exists, as the data may have reached the 24 hour limit and been deleted since the display time and the vote time.
The problem with using something like Datasnapshot.hasChild is that I will need to write 2 separate read and write instructions. The data may exist for the read instruction but then may reach the 24 hour mark and be deleted before the write instruction.
This is the structure of my database, the node status is duplicated in another part of the database in order to reduce the amount of reads. If this node becomes nil, the other one still exists, but this node is here so that I can do one write to obtain all the newest statuses that are less than 24 hours old.
I would like a rule that does not allow the value of votes to change if the key of status has changed, or if status is no longer a node.