Cloud Firestore deep get with subcollection

后端 未结 6 1155
离开以前
离开以前 2020-12-07 18:34

Let\'s say we have a root collection named \'todos\'.

Every document in this collection has:

  1. title: String
  2. subcollection named
6条回答
  •  太阳男子
    2020-12-07 18:55

    As pointed out in other answers, you cannot request deep queries.

    My recommendation: Duplicate your data as minimally as possible.

    I'm running into this same problem with "pet ownership". In my search results, I need to display each pet a user owns, but I also need to be able to search for pets on their own. I ended up duplicated the data. I'm going to have a pets array property on each user AS WELL AS a pets subcollection. I think that's the best we can do with these kinds of scenarios.

提交回复
热议问题