//PhoneProduct is model
//My schema has brand field with string type
var brands = ['apple', 'samsung'];
var QueryResult = PhoneProduct.find().where('brand').equals(brands));
有没有办法让所有品牌的品牌都与品牌阵列中的任何元素相同?
答案 0 :(得分:0)
你不能使用数组驻留字符串,为此你需要检查它是否属于数组, 试试这个
//PhoneProduct is model
//My schema has brand field with string type
var brands = ['apple', 'samsung'];
var QueryResult = PhoneProduct.find({brand: {$in: brands}})
答案 1 :(得分:0)
var QueryResult = PhoneProduct.find({'brand': {$in: brands }})