且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Firestore中的一个集合中获取所有文档

更新时间:2023-02-14 08:08:28

另一个答案中的示例不必要地复杂.如果您要做的只是返回查询或集合中每个文档的原始数据对象,这将更简单:

The example in the other answer is unnecessarily complex. This would be more straightforward, if all you want to do is return the raw data objects for each document in a query or collection:

async getMarker() {
    const snapshot = await firebase.firestore().collection('events').get()
    return snapshot.docs.map(doc => doc.data());
}