首页 > 解决方案 > 如何做一个飞镖颤动的火力基地查询连接

问题描述

我有一个用户的 firestore 表,以及另一个在每个文档上都有 uid 的博客的 firestore 表。我想通过他们的uid加入两个表来做加入查询。我在火灾测验状态管理中找不到这样做的方法。我想定义一个新的类。

BlogData<T> {
  final Firestore _db = Firestore.instance;
  final String path; 
  CollectionReference ref;
  BlogData({ this.path }) {
    ref = _db.collection(path);
  }
  Future<List<T>> getData() async {
    // get blog data and do a join here to a user document by uid (document/blog.uid) return a future of blogs with user data such as name, country added to each blog in the future list.
  }
  Stream<List<T>> streamData() {
    // get blog data and do a join here to the user document  by uid (document/blog.uid) return a stream of blogs with user data such as name, country added to each blog in the stream.
  }
}

我怎样才能做到这一点?

标签: firebaseflutterdartgoogle-cloud-firestore

解决方案


推荐阅读