Skip to content

Commit

Permalink
applying the mongo operator treatment recursively to arrays too in
Browse files Browse the repository at this point in the history
  • Loading branch information
shirouto committed Sep 23, 2020
1 parent ab0cbf0 commit f88a539
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mongoke/templates/resolvers_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,19 @@ def make_edge(node, cursorField):
def strip_nones(x: dict):
result = {}
for k, v in x.items():
if not v == None and v != {}:
if k in MONGODB_OPERATORS:
k = '$' + k
if isinstance(v, dict):
if isinstance(v, list):
result[k] = [strip_nones(x) for x in v if x != None and x != {}]
elif isinstance(v, dict):
result[k] = strip_nones(v)
else:
result[k] = v
return result
'''
'''

0 comments on commit f88a539

Please sign in to comment.