I have the following JSON:
I would like to add the "qtd_lote_vendido" fields, but I am not able to access them.
var query = dbrealtime.ref('eventos/Bzu0eH4jTdbIQmcRuCSa/lotes');
query.on('value', function(snapshot) {
for (var key in snapshot.val()) {
console.log(key);
console.log(snapshot.val().key.qtd_lote_vendido);
}
});
The id is passing correctly.
GuR07hcFOxc1YOCqEPkL
But the field I need not
firebase.js:1 Uncaught TypeError: Cannot read property 'qtd_lote_vendido' of undefined
at (index):46
at firebase.js:1
at exceptionGuard (firebase.js:1)
at e.raise (firebase.js:1)
at e.raiseQueuedEventsMatchingPredicate_ (firebase.js:1)
at e.raiseEventsForChangedPath (firebase.js:1)
at e.onDataUpdate_ (firebase.js:1)
at t.onDataPush_ (firebase.js:1)
at t.onDataMessage_ (firebase.js:1)
at e.onDataMessage_ (firebase.js:1)