[英]Restheart | filter within an array
How do I filter documents if there are sub sets of data (data within arrays) using Restheart 如果使用Restheart有子数据集(数组中的数据),我该如何过滤文档
This is a sample JSON 这是一个示例JSON
{
"_id" : ObjectId("58760e53a4c0a73900472eb0"),
"foods" : [
"root vegetables",
"yogurt",
"other vegetables"
],
"prices" : [
"$1",
"$23",
"$21",
],
"market_ratio" : 0.606299212598425
}
For example I want to get all the documents with foods
that includes ```yogurt 例如,我想获取所有包含```酸奶的
foods
的文档
I tried ?filter={'foods':['yogurt']}&sort_by=+market_ratio"
but it does not return anything. 我尝试了
?filter={'foods':['yogurt']}&sort_by=+market_ratio"
但它不返回任何内容。
正确的方法:
?filter={'foods':{$in:"[yogurt, curd]"}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.