From 0924040fe9a85f0e937719d7e4766fdd6957378b Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 5 Apr 2024 09:37:49 +0200 Subject: [PATCH] Handle regex as string or regex --- collection.mongogx.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/collection.mongogx.js b/collection.mongogx.js index 15b3437..4279dd9 100644 --- a/collection.mongogx.js +++ b/collection.mongogx.js @@ -306,7 +306,10 @@ OGX.MongogxCollection = class{ } break; - case 'regex': + case 'regex': + if(typeof __value[op] === 'string'){ + __value[op] = new RegExp( __value[op] ); + } match = __obj_value.match(__value[op]); break;