In my Firebase database, I need two write to two locations at once. I have rules for both locations that ensure that a user can\'t write there without simultaneously writing
It is now possible to combine multi-path updates with transactions with the introduction of ServerValue.increment()
Example:
Map postLikeUpdate = new HashMap<>();
postLikeUpdate.put("postLikedBy/" + postId + "/" + userId, true);
postLikeUpdate.put("likesCount/" + postId, ServerValue.increment(1));
FirebaseDatabase.getInstance().getReference().updateChildren(postLikeUpdate);
Link to release notes