代码之家  ›  专栏  ›  技术社区  ›  merko

Firestore按文档引用过滤

  •  0
  • merko  · 技术社区  · 4 年前

    react-native-firebase . 我需要字段(DocumentReference)位于所提供数组中的所有文档:

     const subscriber = firestore()
            .collection('strategyCounts')
            .where(
              'strategy',
              'in',
              user.strategies.map(strategy => {
                return strategy.path;
              }),
            ).onSnapshot(...)
    

    user.strategies ["/strategies/id", "/strategy/id2"]

    strategyCounts

    strategies

    users

    1 回复  |  直到 4 年前
        1
  •  0
  •   Frank van Puffelen    4 年前

    DocumentReference 数组中的对象。比如:

      user.strategies.map(strategy => {
        return firestore().doc(strategy.path);
      }),
    

      user.strategies.map(strategy => firestore().doc(strategy.path)),
    
    推荐文章