更新时间:2023-02-06 21:30:44
观看此视频(使用JavaScript,但它确实解决了您的问题):
Take a look at this video (it's in JavaScript, but it exactly solves your problem): https://youtu.be/sKFLI5FOOHs?t=612
基本上,您需要为查询构建数据.在OP示例中,问题将具有类似category_level: "cat_1"
的字段.然后,您可以执行查询equalTo("cat_1")
.如果需要其他查询,则可以省略category
和level
字段(但是在这种情况下,您将需要处理重复项).
Basically, you need to structure your data for your queries. In OP example Question will have field like category_level: "cat_1"
. Then you can perform query equalTo("cat_1")
. You can leave out both category
and level
fields if you need it for other queries (but you will need to handle duplication in that case).
如果您知道项目数量很少,最简单的解决方案是仅提取所有category=cat
并过滤level=1
项目.
If you know that your number of items is small, simplest solution is to just pull all category=cat
and filter level=1
items.