Firestore, retrieve specific fields as JSON?

I'm trying to retrieve specific fields from a given firestore collection (inside of an HTTPSCallable) but I'm getting "nulls" for fields that I know exist and have data. Any ideas what I'm doing wrong?

var docs;
        await db
          .collection(mycollection)
          .where("flag", "==", "true")
          .get()
          .then((querySnapshot) => {
            docs = querySnapshot.docs.map((doc) => {
              doc.data();
            });
          });
        return JSON.stringify({ mydocs: docs });


Read more here: https://stackoverflow.com/questions/68473656/firestore-retrieve-specific-fields-as-json

Content Attribution

This content was originally published by Cliff Helsel at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: