Export json from Firestore

后端 未结 9 2046
时光取名叫无心
时光取名叫无心 2020-12-14 05:55

As we can download json file at Firebase RTDB console, are there any way to export json file of Firestore collection/document data?

One of my main objectives is to c

9条回答
  •  一生所求
    2020-12-14 06:33

    Open any of your clientside firebase apps (React, Angular, etc.). Use this code anywhere to log console and copy

    const products = await db
      .collection("collectionName")
      .where("time", ">", new Date("2020-09-01"))
      .get()
    
    
    const json = JSON.stringify(products.docs.map((doc) => ({ ...doc.data() })))
    console.log(json)
    

提交回复
热议问题