首页 > 解决方案 > 如何根据mongoDB中的输入数组过滤集合

问题描述

我想从输入数组中获取所有匹配的数据...

假设我的数据收集是这样的 {...others, brand: Samsung },{...others, brand: Apple },{...others, brand: Oneplus },

现在我想通过 API 主体发送条件来查询这个集合。假设我的标准是这样的,{ brand: ['Samsung,' Apple'] }如何运行 mongo 查询,以便 mongo DB 向我返回其品牌名称存在于此 API 正文数组中的所有文档

标签: node.jsmongodbmongoose

解决方案


推荐阅读