1
I have this following 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 results where the vendor node with the CNPJ attribute is equal to the sent parameter.
I’m trying something like this, but I’m not getting results, returns nothing.
const rootRef = firebase.database().ref();
return rootRef.child('produtos/').orderByChild('fornecedor/cnpj').equalTo('123234534534');
I understand, there is nothing simpler is it? That is solved in the orderByChild or equalto? A way to make him return the father’s records with the child as a filter?
– Igor Soares