【发布时间】:2018-11-05 11:54:30
【问题描述】:
我正在使用 Firestore 和 Angularfire2 创建一个 Ionic 应用程序。
我的数据库结构如下:
- creators
- CREATOR_ID
- name (string)
- description (string)
- posts (map)
- category1 (array)
- [POST1, POST2, POST3]
- category2 (array)
- [POST3, POST4, ...]
创建者可以创建帖子/文章。当创作者创建文章时,他可以指定该帖子属于哪些类别!
关于应用程序的问题是,当用户想要按类别过滤时,它会将包含至少一个帖子的所有 CREATORS 都包含在用户选择的类别中(而不是带来该类别中的所有文章)。
所以,根据上面的结构,我尝试了以下方法:
this.afs.collection<Creator>('creators', ref => ref.where("posts.category1", '>', ""));
但它什么也没返回!
你们有什么建议吗?
谢谢!
【问题讨论】:
标签: ionic3 google-cloud-firestore angularfire2