In Firebase Realtime Database, let's say that I need to add a child_node1 to node1 and, immediately after that, a child_node2 to node2, the information being related.
I could easily add the second child node in the completion handler of the insertion of the first child node. But what if the user closes the app exactly during the second call? Or the network suddenly goes down?
How should I make sure that the information gets committed if and only if both calls (transactions) succeed?
For example, after creating a user in the main node (users), I want to also add him in another node called users-locations according to his location. What if an error occurs after adding in users but before finishing adding in users-locations?
Thanks!