Firebase cannot retrieve data from database “db.collection is not a function”

前端 未结 1 536
误落风尘
误落风尘 2020-12-18 03:20

Cannot get anything from the firebase database. It is showing an error of:

Uncaught TypeError: db.collection is not a function

I have the script

相关标签:
1条回答
  • 2020-12-18 03:34

    Change this:

    const db = firebase.database();
    

    into this:

    const db = firebase.firestore();
    

    Since you are using firestore and not realtime database.

    more info here:

    https://firebase.google.com/docs/firestore/quickstart#initialize

    0 讨论(0)
提交回复
热议问题