0

如果使用 Restheart 存在子数据集(数组中的数据),我如何过滤文档

这是一个示例 JSON

{
    "_id" : ObjectId("58760e53a4c0a73900472eb0"),
    "foods" : [ 
        "root vegetables", 
        "yogurt", 
        "other vegetables"
    ],
    "prices" : [ 
        "$1",
        "$23",
        "$21",
    ],
    "market_ratio" : 0.606299212598425
}

例如,我想获取所有foods包含 ```yogurt的文档

我试过?filter={'foods':['yogurt']}&sort_by=+market_ratio"了,但它没有返回任何东西。

4

1 回答 1

0

正确的方法:

?filter={'foods':{$in:"[yogurt, curd]"}}
于 2017-01-23T10:01:12.740 回答