Skip to content Skip to sidebar Skip to footer

Collections Keeps Retrieving Me "undefined"

I just cant seem to get the snapshot docs to show me the data from the server. i have checked the collection. it is called 'creaciones' without uppercase. I have 1 document and I h

Solution 1:

db.collection('usuarios').get().then(function(querySnapshot) {
    querySnapshot.forEach(function(doc){
        console.log(doc.data);
    });
    setupGrilla(snapshot.docs);

}); 

That code is just what I have tried before. No need to look into that because I don't have it written at the moment.

Solution 2:

You are calling setupGrilla with a snapshot.docs argument, but snapshot is never defined.

Try querySnapshot.docs instead, or rename querySnapshot in snapshot.

You are also passing the wrong argument to your method

db.collection('usuarios').get().then(function(snapshot) {
    snapshot.forEach(function(doc){
        console.log(doc.data);
    });
    setupGrilla(snapshot); // <-- Here

});

Post a Comment for "Collections Keeps Retrieving Me "undefined""