Run transaction on a root node #196
Open
Labels
Comments
|
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
|
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I am not sure whether following problem is a design decision or an issue.
Let's assume we have this DB Structure:
{
users: {... /* a node with many users here, having their id as index / ...},
messages: {... / same as users */ ...
}
whenever I call a transaction on a root-node reference and try to access the child "users", I receive a a node with 0 children. However, I'd like to have access to all children from users.
`DatabaseReference transactionReference = FirebaseDatabase.getInstance().getReference().getRoot().runTransaction(new Transaction.Handler() {
@override
public Transaction.Result doTransaction(MutableData currentData) {
MutableData mutableUsersNode = currentData.child("users");
//mutableUsersNode.getChildrenCount() would return 0 when in fact it is more
}
});
`
I can , however, access the children of any Mutable node when it is not one of the root leafs (here users and messages).
Am I doing something wrong here?
What's the best solution to run an atomic transaction on a top-level node?
best regards
The text was updated successfully, but these errors were encountered: