【发布时间】:2019-06-30 04:36:58
【问题描述】:
我正在使用 Mongo DB 上的 Open Food Facts 数据集 (wget https://static.openfoodfacts.org/data/openfoodfacts-mongodbdump.tar.gz)。
我正在尝试从表db.products 中获取所有产品,其中字符串ingredients_text 包含特定文本(水、大蒜、...)并且没有任何category。
我已经彻底搜索了其他主题和线程,我来到了这个查询:
db.products.find({categories:{$in:[null,""]},ingredients_text:{$in:[/water/,/garlic/i]}}).count()
我们是否同意这给我所有没有category,并且ingredients_text 字符串包含水(不区分大小写)或大蒜(不区分大小写)的产品?
非常感谢!
阿诺
【问题讨论】:
标签: string mongodb search mongodb-query substring