从firebase嵌套对象中获取计数

时间:2017-12-16 13:24:05

标签: javascript typescript firebase firebase-realtime-database angularfire2

我有以下方案enter image description here

尝试以下操作失败:

  this._directChatsRef = this.db.list(`users/${this.authProvider.getUID()}/chat`, {
    query: {
      orderByChild: 'read',
      equalTo: false
    }
  });
  this._directChatsRef.subscribe((directChats) => {
    this._chats = directChats.length;
  });

我知道chat对象正上方有一个对象,但是如何使用指定的查询返回firebase中的聊天对象数组呢?

这样做的目的是获取unread条消息。

谢谢!

0 个答案:

没有答案