代码之家  ›  专栏  ›  技术社区  ›  BIS Tech

使用Flutter在一次往返中从firestore获取10多个文档

  •  0
  • BIS Tech  · 技术社区  · 5 年前

    我当前正在使用 whereIn 为了这个。但一次只能得到10个或更少的药水。 根据firestore文档,其中10个条目或更少

    有没有办法在一次往返中一次得到10份以上的文件?

     return _db
            .collection('books')
            .where('docId', whereIn: ['id1', 'id2'...'id10'])
            .get()
            .then((value) => value.docs.map((e) => BookModel.fromFireStore(e)).toList());
    
    1 回复  |  直到 5 年前
        1
  •  2
  •   Doug Stevenson    5 年前

    不,10是硬限制,不能超过。您需要执行多个查询才能按ID获取10个以上的文档 documentation 州:

    in 在逻辑字段上(=)与相等或相等子句组合。

    推荐文章