Firestore query subcollections

后端 未结 11 1513
余生分开走
余生分开走 2020-11-22 09:24

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

11条回答
  •  深忆病人
    2020-11-22 09:39

    It could be better to use a flat data structure.
    The docs specify the pros and cons of different data structures on this page.

    Specifically about the limitations of structures with sub-collections:

    You can't easily delete subcollections, or perform compound queries across subcollections.

    Contrasted with the purported advantages of a flat data structure:

    Root-level collections offer the most flexibility and scalability, along with powerful querying within each collection.

提交回复
热议问题