Browse Source

Added the conversion between a string and a list for the "in"/"not in" operators

Roland Haroutiounian 7 years ago
parent
commit
bb60b09d66
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      plugins/mongodb_datasource/datasource.py

+ 4
- 0
plugins/mongodb_datasource/datasource.py View File

@@ -807,6 +807,9 @@ by an equality filter")
807 807
         #Converting lodel2 wildcarded string into a case insensitive
808 808
         #mongodb re
809 809
         if mongop in cls.mongo_op_re:
810
+            if value.startswith('(') and value.endswith(')') and ',' in value:
811
+                mongoval = [ item for item in mongoval[1:-1].split(',') ]
812
+        elif mongop == 'like':
810 813
             #unescaping \
811 814
             mongoval = value.replace('\\\\','\\')
812 815
             if not mongoval.startswith('*'):
@@ -817,6 +820,7 @@ by an equality filter")
817 820
             #Replacing every other unescaped wildcard char
818 821
             mongoval = cls.wildcard_re.sub('.*', mongoval)
819 822
             mongoval = {'$regex': mongoval, '$options': 'i'}
823
+
820 824
         return (op, mongoval)
821 825
 
822 826
     ##@brief Convert a list of tuple(OP, VALUE) into a pymongo filter dict

Loading…
Cancel
Save