Skip to content

Commit c30a586

Browse files
Support added for __gte operations in info.context.queryset
1 parent 5db17de commit c30a586

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

graphene_mongo/fields.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,16 @@ def chained_resolver(self, resolver, is_partial, root, info, **args):
391391
args_copy.pop(arg_name)
392392
if arg_name == '_id' and isinstance(arg, dict):
393393
args_copy['pk__in'] = arg['$in']
394+
elif "$ne" in arg:
395+
args_copy['pk__ne'] = arg['$ne']
394396
if '.' in arg_name:
395397
operation = list(arg.keys())[0]
396398
args_copy[arg_name.replace('.', '__') + operation.replace('$', '__')] = arg[operation]
399+
else:
400+
if isinstance(arg, dict) and ('$lte' in arg or '$gte' in arg):
401+
operation = list(arg.keys())[0]
402+
args_copy[arg_name + operation.replace('$', '__')] = arg[operation]
403+
del args_copy[arg_name]
397404
return self.default_resolver(root, info, required_fields, **args_copy)
398405
else:
399406
return resolved

0 commit comments

Comments
 (0)