Firebase Firestore get all collections in document web version 9

Viewed 11

I'm trying to fetch all collections in a document using the web version of firestore but I can't find any docs on how to do it or stack overflow answers. I've done it before using the node.js admin sdk of Firebase, but never with the web version.

My code looks like this, I just want to get all collections and have the ability to map through them.

async function checkIfBatchExists(batch) {
    const codeRef = doc(db, "batches", batch);
    const codeSnap = await getDoc(codeRef);

    if (codeSnap.exists()) {
        // I would like to map through all collections in this document.
        return true;
    } else {
        console.log("No such document!");
        return true;
    }
}
0 Answers
Related