Skip to content

Commit ec02ec1

Browse files
Operation ["$lte", "$gte", "$ne"] support added in info.context.queryset
1 parent c30a586 commit ec02ec1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphene_mongo/fields.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ def chained_resolver(self, resolver, is_partial, root, info, **args):
390390
self.filter_args.keys()):
391391
args_copy.pop(arg_name)
392392
if arg_name == '_id' and isinstance(arg, dict):
393-
args_copy['pk__in'] = arg['$in']
394-
elif "$ne" in arg:
395-
args_copy['pk__ne'] = arg['$ne']
393+
operation = list(arg.keys())[0]
394+
args_copy['pk' + operation.replace('$', '__')] = arg[operation]
396395
if '.' in arg_name:
397396
operation = list(arg.keys())[0]
398397
args_copy[arg_name.replace('.', '__') + operation.replace('$', '__')] = arg[operation]
399398
else:
400-
if isinstance(arg, dict) and ('$lte' in arg or '$gte' in arg):
399+
operations = ["$lte", "$gte", "$ne"]
400+
if isinstance(arg, dict) and any(op in arg for op in operations):
401401
operation = list(arg.keys())[0]
402402
args_copy[arg_name + operation.replace('$', '__')] = arg[operation]
403403
del args_copy[arg_name]

0 commit comments

Comments
 (0)