-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers
Description
Hi,
currently it is not possible to apply options to a regexp when using the fetchByFilter method.
The reason is that the value is always treated as string and not as a regex.
So this is not working:
await fsxaApi.fetchByFilter({
filters: [
{
field: 'formData.st_searchterms.value',
operator: '$regex',
value: "/Suchbegriff(,|$){1}/i",
},
],
});
The query builder renders this url:
&filter={"formData.st_searchterms.value":{"$regex":"/Suchbegriff(,|$){1}/i"}}
But for the Mongodb to correctly interpret the regexp the quotes need to be omitted:
&filter={"formData.st_searchterms.value":{"$regex":/Suchbegriff(,|$){1}/i}}
Alternatively it is possible to work with this syntax according to the MongoDB-Documentation:
&filter={"formData.st_searchterms.value":{"$regex":"OnlineService(,|$){1}", "$options": "i"}}
So possibly allowing an option property in the filter object would also help here.
Thanks!
LarsOlt
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers