Let's say that my database looks like this :
"users": {
"userID1": {
"profile": {
"name": "John",
"surname": "Nhoj"
},
"some-extra-data": "lot of child nodes"
}
}
I want to query name
with equalTo("John")
, how is the price calculated ?
Does it loop through all users records and charge it ? Or is it only 2 reads (name
and surname
) ?
I don't get how it actually query datas, I have the feeling that it reads for all user ids and look for users/${userId}/profile/name == "John"
So if there is 100k users, it will query 100k users to get the name and charge read of these 100k users.
CodePudding user response:
Does it loop through all users records?
Yes, it will check against all users. In order to know which child is "John", the query must evaluate all children within the node, and it will return as a result only the matching elements.
If your database gets bigger, then you should consider adding a new database, simply by creating a new instance of the Firebase Realtime Database.