I am inserting data in Firebase Realtime Database in a table with the above structure. The key of the data is auto-generated based on
push
. After several such entries are created, sometime due to certain conditions I may need to delete one of the entries. At the point of deleting the entry, I may know some of the values of the node that I want to delete like createdAt
and createdForPostID
. But I will not know the key as it was auto-generated using push
feature of firebase database. A combination of createdAt
and createdForPostID
makes a unique combination and only one such entry should exist in the database.
What would be the most efficient way to identify the entry without having to retrieve the entire node at OUTBOUND
?
The reason I am using push
is because Firebase claims it to be efficient and not subject to write conflicts. I also rely on the auto-sorting by date/time offered by push
.
If no efficient way can be found, then I will generate my own key using date/time stamp. But I am hoping that this is a problem that someone has solved before and hence can guide me.
Any suggestions are welcome.