mardi 28 décembre 2021

I want to read data from cloudfirebase subcollection into HTML table in NodeJS

I want to fetch Subcollection from CloudFirestore.

Database Model is as follow

Users //It is a collection Student //It is a document Students// A subcollection with some documents(IDs) OqlDiQkN3MVoEfN9M0h06aFfO873 QayxOc1RMSPWH9Y8ns3bBL9iid63 Here is my Snippet of Code:

async function GetAllDataOnce(){ //Reference to Subcollection const studentsRef = doc(db,"Users","Student","Students","OqlDiQkN3MVoEfN9M0h06aFfO873"); const querySnapshot = await getDocs(collection(db,"studentsRef")); var _vehicles = []; querySnapshot.forEach(doc=>{ _vehicles.push(doc.data()); }); AddAllItemsToTable(_vehicles);
} Through this function, I want to display all my data in the HTML Table. Yet my table is getting no value.




Aucun commentaire:

Enregistrer un commentaire