I am working on a simple Android application. I'm having problems using the Firebase database, because it uses JSON objects, and I'm used to relational databases.
My data will consist of two users that matter. In relational databases, this will be presented in the table as follows:
**uname1** **uname2** shared_value
In which usernames are keys. If I wanted all the values โโof the user Bob together with other users, I could make a simple union operator that would return strings where:
uname1 == Bob or unname == Bob
However, there seems to be a tree hierarchy in the JSON databases in the data, which is difficult since I could not find users at the top level. I am looking for help on how to do this or how to structure my database for better performance if my most general search is similar to the one above.
If this is not enough, I will clarify: my database will be structured as follows:
{
'username': 'Bob'
{
'username2': 'Alice'
{
'shared_value' = 2
}
}
'username': 'Cece'
{
'username2': 'Bob'
{
'shared_value' = 4
}
}
As you can see from the example, Bob is included in two respects, but a search in the Bobs node does not show this information. (Communication is commutative, so who the "first" cannot be predicted).
. , Bob- > Alice- > 2, Alice- > Bob- > 2. , , . , .