From 6a07f0493ab570736b244f931a440307b0bf92ec Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 5 May 2021 22:51:27 +0300 Subject: fix: correctly check if query is using regex --- src/hooks/ignoreCaseRegex.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/hooks/ignoreCaseRegex.ts b/src/hooks/ignoreCaseRegex.ts index 3a1ab63..a9ddb31 100644 --- a/src/hooks/ignoreCaseRegex.ts +++ b/src/hooks/ignoreCaseRegex.ts @@ -3,7 +3,7 @@ import _ from 'lodash'; const ignoreCaseRegex = async (context: HookContext): Promise => { context.params.query = _.mapValues(context.params.query, data => { - return '$regex' in data ? _.set(data, '$options', 'i') : data; + return _.has(data, '$regex') ? _.set(data, '$options', 'i') : data; }); return context; }; -- cgit v1.2.3