As far as I know you cannot modify database's layout using API
There is nothing like a "Layout" in FB Reatime Database.
Every "node" can hold any kind of json-Data. The main problem in here is to hold the Database structure as flat as possible to prevent unneccessary Traffic.
If you store a deep structure inside a Node and you request the content of this node every sub-node-data inside creates traffic.
In my tests with the Database i learned that using Helper classes for the different subnodes can be helpful. Though they must be done in java.
The Firebase Realtimedatabase library can be used if you do not want to query a filtered subset of data. and not use any Sorting. This is not working as of now. I never get it working as expected.
But the base itself is working.
I would use the RTDB-Library to setup listener to a specific subset of the Database to GET the data automatically if it changes.
WRITING to the db i would do using the REST Api from Firebase. Even requesting simple subsets and sorting will work using REST i guess.
So far i did not get sorting working using REST if the database does not have Indexes set correctly for such sorting.
for exampe
Dim j As HttpJob
j.Initialize("", Me)
j.Download($"https://xxxxxxxxx.firebaseio.com/users/xxxxxxx/Messages.json?orderBy="From""$)
j.GetRequest.SetHeader("Authentication","bearer "&Token)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
Else
'oauth2.ResetToken
Log("Online data not available.")
End If
j.Release
will result in
ResponseError. Reason: Bad Request, Response: {
"error" : "Index not defined, add \".indexOn\": \"From\", for path \"/users/xxxxxxx/Messages\", to the rules"
}
Online data not available.
Solution is then to update the Firebase Database rules and setup an index.
Using the FBRLDB you´ll get a similar error when using Orderby. But here you´ll get a full url link which your just open in a browser to inset the needed index without doing it manually.
At the end i can not provide any really working example, sorry. Just a few of my findings... My 2cent so to say ;-)