Firebase Transactions of Add, Delete on Multiple Nodes

Viewed 868

I have Firebase structure which contains Users and Groups in Android. It's a many to many relationship.

Firebase Structure

When I am adding any user in the group node, I also add the group in the user node but without using any kind of transaction mechanism.

Now I need to do the delete group case where it will remove the Group node as well as the group property inside User Node where each User Joined. There must be a transaction in this scenario. So far i have dealt with the transaction code which relies on the same node but not on different node.

I need to know how to implement transaction in case of adding and deletion on multiple nodes or is there a better way of implementing it.

1 Answers
Related