3 node.js firebase firebase-admin google-cloud-firestore
我正在尝试使用 angularfire2 从我的 firestore 数据库中检索数据。这就是我当前的数据库的样子。我有一个用户集合,其中包含将 userDetails 和 userPosts 绑定在一起的 userId 文档。

但是,当我查询这个集合时,它在控制台中返回一个空数组。
我正在使用 firebase 函数来检索数据。
Firebase 函数索引.ts
export const getFeed = functions.https.onCall(async (req,res) =>{
const docs = await admin.firestore().collection('users').get()
return docs.docs.map(doc => {
return {
postID: doc.id,
...doc.data()
}
})
})
Run Code Online (Sandbox Code Playgroud)
TS文件
tabTwoFeedInit (){
const getFeed = this.aff.httpsCallable('getFeed')
this.ajax = getFeed({}).subscribe(data=> {
console.log(data)
this.posts = data
})
}
Run Code Online (Sandbox Code Playgroud)
如何成功从此 Firebase 数据库检索数据?
| 归档时间: |
|
| 查看次数: |
4334 次 |
| 最近记录: |