Skip to content

Commit 30cb26a

Browse files
Merge branch 'support-point-field-in-args'
2 parents fd6ceb3 + ec02ec1 commit 30cb26a

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
@@ -394,14 +394,14 @@ def chained_resolver(self, resolver, is_partial, root, info, **args):
394394
self.filter_args.keys()):
395395
args_copy.pop(arg_name)
396396
if arg_name == '_id' and isinstance(arg, dict):
397-
args_copy['pk__in'] = arg['$in']
398-
elif "$ne" in arg:
399-
args_copy['pk__ne'] = arg['$ne']
397+
operation = list(arg.keys())[0]
398+
args_copy['pk' + operation.replace('$', '__')] = arg[operation]
400399
if '.' in arg_name:
401400
operation = list(arg.keys())[0]
402401
args_copy[arg_name.replace('.', '__') + operation.replace('$', '__')] = arg[operation]
403402
else:
404-
if isinstance(arg, dict) and ('$lte' in arg or '$gte' in arg):
403+
operations = ["$lte", "$gte", "$ne"]
404+
if isinstance(arg, dict) and any(op in arg for op in operations):
405405
operation = list(arg.keys())[0]
406406
args_copy[arg_name + operation.replace('$', '__')] = arg[operation]
407407
del args_copy[arg_name]

0 commit comments

Comments
 (0)