Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

firebase get subcollection

const subColRef = collection(db, "collection_name", "doc_name", "subcollection_name");
// odd number of path segments to get a CollectionReference

// equivalent to:
// .collection("collection_name/doc_name/subcollection_name") in v8

// use getDocs() instead of getDoc() to fetch the collection

const qSnap = getDocs(subColRef)
console.log(qSnap.docs.map(d => ({id: d.id, ...d.data()})))
Comment

PREVIOUS NEXT
Code Example
Javascript :: validatorjs number 
Javascript :: js if and operator 
Javascript :: angular 14 new features 
Javascript :: change parent state from child use effect in react js 
Javascript :: babel minify plugin 
Javascript :: window frames js 
Javascript :: javascript cheat sheet 
Javascript :: how to use $ in javascript 
Javascript :: how to debug node js file in webpack 
Javascript :: bind() method 
Javascript :: create chart in excel using javascript 
Javascript :: big.js 
Javascript :: create javascript for loop 
Javascript :: js standard global 
Javascript :: react component visibility 
Javascript :: javascript weakmap 
Javascript :: how to use paystack with react 
Javascript :: req is not defined 
Javascript :: string object javascript 
Javascript :: sample promise.all javascript 
Javascript :: jquery modal 
Javascript :: this keyword in javscript 
Javascript :: send an email react native 
Javascript :: how to make a bigint in javascript 
Javascript :: convert decimal to hex 
Javascript :: javascript array remove last 
Javascript :: validate country wise phone code javascript 
Javascript :: --env production 
Javascript :: for in and for of in js 
Javascript :: Sequelize using javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =