From f21361340b802eda2022951227a0b91ffb7fe794 Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Sat, 20 Apr 2024 11:17:11 +0530 Subject: [PATCH 1/2] Fix(mongoose-filter-query): default boolean parsing --- packages/mongoose-filter-query/src/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mongoose-filter-query/src/utils.js b/packages/mongoose-filter-query/src/utils.js index ac8750c..6f418ff 100644 --- a/packages/mongoose-filter-query/src/utils.js +++ b/packages/mongoose-filter-query/src/utils.js @@ -43,6 +43,7 @@ export const mapValue = (value) => { } else if (value.startsWith("exists(")) { return { $exists: parseOperatorValue(value, "exists") === "true" }; } + if (value === "true" || value === "false") return value === "true" return value; }; From 2e5319146ee5a286da8c17694ea3be30d32356c5 Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Sat, 20 Apr 2024 11:20:32 +0530 Subject: [PATCH 2/2] Fix: erroneus test --- packages/mongoose-filter-query/test/__mocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mongoose-filter-query/test/__mocks.js b/packages/mongoose-filter-query/test/__mocks.js index cddf968..2596c57 100644 --- a/packages/mongoose-filter-query/test/__mocks.js +++ b/packages/mongoose-filter-query/test/__mocks.js @@ -29,7 +29,7 @@ export const basicFilterResult = { birthdate: { $lte: new Date("2000-01-01") }, isAlive: { $exists: true }, isVerified: { $eq: true }, - isDeleted: "false" + isDeleted: false }; export const complexFilterReq = {