From 61c5ac6a4793023bc33096e800dd7633452c4e00 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Wed, 16 Mar 2022 18:34:44 +0100 Subject: [PATCH] mongo filtersing fixes --- packages/filterparser/src/mongoParser.ts | 2 ++ .../web/src/modals/SetFilterModal_Select.svelte | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/filterparser/src/mongoParser.ts b/packages/filterparser/src/mongoParser.ts index b5dd3335..55ae31bc 100644 --- a/packages/filterparser/src/mongoParser.ts +++ b/packages/filterparser/src/mongoParser.ts @@ -92,6 +92,7 @@ const createParser = () => { eq: r => word('=').then(r.value).map(operatorCondition('$eq')), ne: r => word('!=').then(r.value).map(operatorCondition('$ne')), + ne2: r => word('<>').then(r.value).map(operatorCondition('$ne')), lt: r => word('<').then(r.value).map(operatorCondition('$lt')), gt: r => word('>').then(r.value).map(operatorCondition('$gt')), le: r => word('<=').then(r.value).map(operatorCondition('$lte')), @@ -111,6 +112,7 @@ const createParser = () => { r.false, r.eq, r.ne, + r.ne2, r.lt, r.gt, r.le, diff --git a/packages/web/src/modals/SetFilterModal_Select.svelte b/packages/web/src/modals/SetFilterModal_Select.svelte index be60f803..219f4b8a 100644 --- a/packages/web/src/modals/SetFilterModal_Select.svelte +++ b/packages/web/src/modals/SetFilterModal_Select.svelte @@ -39,6 +39,21 @@ { value: '<=', label: 'is before or equal' }, { value: '>=', label: 'is after or equal' }, ]; + case 'mongo': + return [ + { value: '=', label: 'eqals' }, + { value: '<>', label: 'does not equal' }, + { value: '<', label: 'is smaller' }, + { value: '>', label: 'is greater' }, + { value: '<=', label: 'is smaller or equal' }, + { value: '>=', label: 'is greater or equal' }, + { value: '+', label: 'contains' }, + { value: '~', label: 'does not contain' }, + { value: '^', label: 'begins with' }, + { value: '!^', label: 'does not begin with' }, + { value: '$', label: 'ends with' }, + { value: '!$', label: 'does not end with' }, + ]; } }