Tag: where clause

Sails.js:水线或filter不工作

我正在开发一个sails.js应用程序使用默认水线 。 我有一系列的类别和位置,如下所示。 var categoryOrFilter = [1,2,3]; var locationsOrFilter = [8,9,10]; 我正在尝试在我的model上编写一个where ,它将过滤属于categoryOrFilter中的至less一个categoryOrFilter以及位于locations中的至less一个locations的模型项目。 我的模型如下所示。 attributes: { category: { model: 'category' }, location: { model: 'location' } } 我写了我的查询如下所示。 Model.find() .where({ or: [{ "category": categoryOrFilter }] }) .where({ or: [{ "location": locationsOrFilter }] }) .exec(function (err, modelItem) { //Some logic }); 我的categoryOrFilter值不被考虑。 我的locationOrFilter值工作完美。 我究竟做错了什么?