相关疑难解决方法(0)

如何列出Cloud Firestore文档中的子集合

假设我将此最小数据库存储在Cloud Firestore中.我怎么能检索的名字subCollection1subCollection2

rootCollection {
    aDocument: {
        someField: { value: 1 },
        anotherField: { value: 2 }
        subCollection1: ...,
        subCollection2: ...,
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望能够只读取ID aDocument,但只有字段出现在我get()的文档中.

rootRef.doc('aDocument').get()
  .then(doc =>

    // only logs [ "someField", "anotherField" ], no collections
    console.log( Object.keys(doc.data()) )
  )
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-firestore

9
推荐指数
2
解决办法
3626
查看次数