From 633d3476779ba39660994c790096bea60964f5a2 Mon Sep 17 00:00:00 2001 From: Zeb Barnett Date: Wed, 25 Sep 2019 17:12:40 -0500 Subject: [PATCH] Array and String types should be treated the same way. Fixes bug where search operators weren't working for Array types. --- lib/mongoose-api-query.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/mongoose-api-query.js b/lib/mongoose-api-query.js index eabb266..fc2d8d4 100644 --- a/lib/mongoose-api-query.js +++ b/lib/mongoose-api-query.js @@ -111,7 +111,7 @@ module.exports = exports = function apiQueryPlugin (schema) { addSearchParam(parseInt(val)); } } - } else if (paramType === "String") { + } else if (paramType === "String" || paramType === "Array") { if (val.match(',')) { var options = val.split(',').map(function(str){ return new RegExp(str, 'i'); @@ -153,12 +153,7 @@ module.exports = exports = function apiQueryPlugin (schema) { addSearchParam(distObj); } else if (paramType === "ObjectId") { addSearchParam(val); - } else if (paramType === "Array") { - addSearchParam(val); - console.log(lcKey ) - } - }; var parseParam = function (key, val) {