I'm trying to figure out how, if possible, to query a specifically named child node in all instances of a parent node in Firebase. It can be assumed that all parent nodes queried have this specifically named child node in it.
In this example, uid
is a unique identifier for each user and I'm trying to get a list of displayNames
:
{
users: {
uid: {
displayName: "stringOfSomeKind"
}
uid2: {
displayName: "moreStrings"
}
uid3: {
displayName: "evenMoreStrings"
}
...
}
}
The purpose of this is so I can check to see if a displayName
is currently taken. (I can't use the displayName
as the primary key because when a user logs in, I'll only have the uid
available.)
How can I efficiently check to see if one of these displayNames
is already taken? Do I have to denormalize my data to do so efficiently? If so, how?