From what you mentioned in your last comment, you can traverse a document as you would any other Map
or dictionary object. The Firestore documentation for Getting documents is a good place to start. As for your nested field, if you would like to get the Title
value, you could do it this way, by traversing the dictionary into the points
array, then traversing the nested dictionary to the Title
value:
const docRef = doc(firestoreDB, "innerArray", "testDoc1");
const getData = async () => {
const docSnap = await getDoc(docRef);
console.log(docSnap.data().points[0].title) //traversing the data obtained from a document
}
This outputs foo
, which is the value for Title
in my test document.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.