I have this structure:
{
"3" : {
"data" : "2017-09-21",
"fornecedor" : {
"cnpj" : "123234534534",
"fantasia" : "Barreirinha"
},
"nNF" : 3,
"peso" : 3,
"precoCompra" : 6,
"vendido" : false
},
"123" : {
"data" : "2017-09-14",
"fornecedor" : {
"cnpj" : "123234534534",
"fantasia" : "Barreirinha"
},
"nNF" : 123,
"peso" : 23000,
"precoCompra" : 2.21,
"vendido" : false
}
}
I need to filter this list with only the results where the provider node with the CNPJ attribute is equal to the parameter sent.
I'm trying something like this, but I'm not getting results, it does not return anything.
const rootRef = firebase.database().ref();
return rootRef.child('produtos/').orderByChild('fornecedor/cnpj').equalTo('123234534534');