I am aware that you can do batched, atomic all or nothing updates using update - but can you do the same thing with a transaction?
Currently I am trying to increment a users friend count (2 users) at the same time when the friend request is accepted.
Here is what I am doing which works, but if something goes wrong it will lead to bad data inconsistencies which came about a couple times.
  const upOneFriend = firebase
    .database()
    .ref("users")
    .child(friend.uid)
    .child("friendCount");
  const upOneCurrentUser = firebase
    .database()
    .ref("users")
    .child(userUid)
    .child("friendCount");
  upOneFriend
    .transaction(currentCount => {
      return currentCount + 1;
    })
    .then(() => {
      upOneCurrentUser.transaction(currentCount2 => {
        return currentCount2 + 1;
      });
    })
    .catch(() => {
      console.log("error increment");
    });
Like I said, is works, but I need to do this at the same time! I have looked around and have not found anything related to batch transactions for the Realtime Database.
Cheers.
 
    