【问题标题】:Don't get data from firestore不要从 Firestore 获取数据
【发布时间】:2021-01-02 08:37:39
【问题描述】:

伙计们,谁能向我解释为什么我无法从 Firestore 中读取数据?我已经阅读了文档并多次查看了路径,但仍然看不到它。我在做离子

   getChat(chatId){
        const chatRoom = this.firestore.collection('/business/').doc(chatId);
        const room = chatRoom.get();
        console.log(room);
      }

Observable {_isScalar: false, source: Observable, operator: ObserveOnOperator}
operator: ObserveOnOperator {scheduler: ɵZoneScheduler, delay: 0}
source: Observable {_isScalar: false, _subscribe: ƒ}
_isScalar: false
__proto__: Object

【问题讨论】:

  • 这里出了什么问题?它返回一个可观察的

标签: angular typescript ionic-framework google-cloud-firestore chat


【解决方案1】:

试试这个:复制此代码后检查所有括号和“chatId”是否正确

getChat(chatId){
        const chatRoom = this.firestore.collection('/business/').doc(chatId);
        const room = chatRoom.get().subscribe(o => {
             console.log(k.data());              
        })
      }

【讨论】:

  • VizaintProperty 'forEach' 在类型 'DocumentSnapshot' 上不存在
  • 我的错我修改我的答案现在试试
猜你喜欢
  • 1970-01-01
  • 2018-11-06
  • 2021-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多