Firestore查询子集合 [英] Firestore query subcollections

查看:263
本文介绍了Firestore查询子集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我已经读过,您可以使用新的Firebase Firestore查询子集合,但是我没有看到任何示例。例如我有我的Firestore安装在以下方式:

$ ul
  • 跳舞[集合]


    • danceName

    • 歌曲[集合]


      • 歌曲名称
        <




    如何查询Find all dances where songName =='X'

    解决方案

    这是一个尚不存在的功能。这就是所谓的收集组查询,可以让你查询所有的歌曲,而不管哪个舞蹈包含它们。这是我们打算支持,但没有一个具体的时间表什么时候到来。



    在这一点上的替代结构是使歌曲顶级集合并使其跳舞的歌曲是该歌曲属性的一部分。


    I thought I read that you can query subcollections with the new Firebase Firestore, but I don't see any examples. For example I have my Firestore setup in the following way:

    • Dances [collection]
      • danceName
      • Songs [collection]
        • songName

    How would I be able to query "Find all dances where songName == 'X'"

    解决方案

    This is a feature which does not yet exist. It's called a "collection group query" and would allow you query all songs regardless of which dance contained them. This is something we intend to support but don't have a concrete timeline on when it's coming.

    The alternative structure at this point is to make songs a top-level collection and make which dance the song is a part of a property of the song.

    这篇关于Firestore查询子集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆