From ae7583401ec3fdc44769f15975392ce09fcf0155 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 30 Jul 2020 13:39:54 -0400 Subject: [PATCH] allows for sanitization of string true / false in buildQuery --- src/mongoose/buildQuery.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mongoose/buildQuery.js b/src/mongoose/buildQuery.js index b149dd7a60..4ca743ab06 100644 --- a/src/mongoose/buildQuery.js +++ b/src/mongoose/buildQuery.js @@ -171,6 +171,11 @@ class ParamParser { let formattedValue = val; + if (schemaObject && schemaObject.type === Boolean && typeof val === 'string') { + if (val.toLowerCase() === 'true') formattedValue = true; + if (val.toLowerCase() === 'false') formattedValue = false; + } + if (operator && validOperators.includes(operator)) { switch (operator) { case 'greater_than_equal':