I have this data structure in my firebase.
"produtos" : {
"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 get a list of values of objects that contain the CNPJ
key.
I'm using Angular, AngularFire2 and TypeScript, but I can not understand.
retrieveProdutos(cnpjFornecedor: string) {
this.produtos = this.db.list(this.paths.pathProduto, {
query: {
orderByChild: 'cnpj',
equalTo: cnpjFornecedor,
orderByKey: true,
}
});
}
How do I get this list? is returning empty.