I've done a question here in SOpt on how to search the firebase realtime database , and @ RosárioPereiraFernandes suggested changing the structure of the bank
Old structure:
{
"-L4Wqs3YbAlUgTWElF4Q" : {
"receita" : {
"-L6m_C46-Mj1py6RtF8H" : {
"imagem" : "default",
"ingrediente" : [ "ovo", "leite" ],
"nome" : "um nome",
"preparo" : "um preparo",
"tipo" : true
},
"-L6m_Finc29fAlqU0nqe" : {
"imagem" : "default",
"ingrediente" : [ "amendoim" ],
"nome" : "teste",
"preparo" : "teste",
"tipo" : false
}
},
"senha" : "123456789",
"usuario" : "guilherme"
},
"-L4WrImJ05VhzBgKHX6S" : {
"senha" : "123456789",
"usuario" : "patricia"
}
}
New structure:
{
"usuarios":{
"-L4WrImJ05VhzBgKHX6S" : {
"senha" : "123456789",
"usuario" : "patricia"
},
"-L4Wqs3YbAlUgTWElF4Q" : {
"senha" : "123456789",
"usuario" : "guilherme"
}
},
"receitas":{
"-L6m_C46-Mj1py6RtF8H" : {
"imagem" : "default",
"ingrediente" : [ "ovo", "leite" ],
"nome" : "um nome",
"preparo" : "um preparo",
"tipo" : true,
"usuario":"-L4WrImJ05VhzBgKHX6S"
},
"-L6m_Finc29fAlqU0nqe" : {
"imagem" : "default",
"ingrediente" : [ "amendoim" ],
"nome" : "teste",
"preparo" : "teste",
"tipo" : false,
"usuario":"-L4WrImJ05VhzBgKHX6S"
}
}
}
Not the case, but what if I wanted to change into a bank that is already in production and has millions of users? Something with JavaScript or right in the Firebase console