From 49ebb7a19539f35894293e9f3e947fb952870528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= Date: Thu, 29 Jun 2023 12:08:05 +0100 Subject: [PATCH] fix: issue to wrong option in regex --- CHANGELOG.md | 2 +- src/appier/model.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36888980..aec8bdc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -* +* Issue related to wrong regex option in MongoDB ## [1.31.1] - 2023-05-31 diff --git a/src/appier/model.py b/src/appier/model.py index 4739c1cd..2d24f3dd 100644 --- a/src/appier/model.py +++ b/src/appier/model.py @@ -1913,7 +1913,7 @@ def _find_s(cls, kwargs): # exact match of the value (required type conversion) if default_t in legacy.STRINGS: find_v = { "$regex" : right + re.escape(find_s) + left, - "$options": "-i" if find_i else "" + "$options": "i" if find_i else "" } else: find_v = default_t(find_s) except Exception: @@ -2000,7 +2000,7 @@ def _find_d(cls, kwargs): # the value is used directly, then merges this find value into the # current set of filters for the provided (keyword) arguments find_v = {operator : value} if operator else value - if insensitive: find_v["$options"] = "-i" + if insensitive: find_v["$options"] = "i" cls.filter_merge(name, find_v, kwargs, operator = find_o) @classmethod