[英]Firestore get roots field of a document
根據您在上一條評論中提到的內容,您可以像遍歷任何其他Map
或字典 object 一樣遍歷文檔。 獲取文檔的 Firestore 文檔是一個很好的起點。 至於您的嵌套字段,如果您想獲取Title
值,您可以這樣做,通過將字典遍歷到points
數組中,然后將嵌套字典遍歷到Title
值:
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
}
這將輸出foo
,這是我的測試文檔中Title
的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.