【发布时间】:2019-09-03 20:04:27
【问题描述】:
我可以在 firestore 中查询多个关键字吗?如何匹配 firestore 中的一组关键字?
我有一个带有标题的文档集合,我想查询包含特定关键字的文章。
以下是我的文档结构。
{
"users": {
"user_id_1": {
"username": "user one",
"profile_pic": "some_url",
"articles": {
"article_id_1": {
"title": "Firebase is so cool",
"comments": {
"comment_id_1": "First comment",
"comment_id_2": "I like trains"
}
},
"article_id_2": {
"title": "Firestore rocks!",
"comments": {
"comment_id_1": "SQL it's better",
"comment_id_2": "Do you know the wae?"
}
},
"article_id_3": {
"title": "Firestore awesome",
"comments": {
"comment_id_1": "SQL it's better",
"comment_id_2": "Do you know the wae?"
}
},
"article_id_4": {
"title": "Firestore is easy",
"comments": {
"comment_id_1": "SQL it's better",
"comment_id_2": "Do you know the wae?"
}
}
}
}
}
}
这里我想根据以下关键字搜索文章。
["cool", "rocks", "Firestore is easy"]
我应该得到 article_id_1、article_id_2 和 article_id_4
谢谢。
【问题讨论】:
-
您可能希望编辑您的问题,以更好地说明文档的内容,以及您希望针对该数据执行的查询类型,并获得预期的结果。
-
@DougStevenson - 我已经添加了文档结构。谢谢!
标签: firebase google-cloud-firestore