0
I made a question here at Sopt on how to do a search on the firebase Realtime database, and @Rosáriopereirafernandes suggested changing the structure of the database
Ancient 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"
}
}
}
This is not the case, but what if I wanted to change in a bank that is already in production and has millions of users? Something with Javascript or directly in the Firebase console