flip value before changing op to inc
This commit is contained in:
parent
408274152b
commit
e83b529f1c
@ -221,13 +221,13 @@ def update(_doc_cls=None, **update):
|
|||||||
'add_to_set': 'addToSet',
|
'add_to_set': 'addToSet',
|
||||||
'set_on_insert': 'setOnInsert'
|
'set_on_insert': 'setOnInsert'
|
||||||
}
|
}
|
||||||
# If operator doesn't found from operator map, op value will stay
|
|
||||||
# unchanged
|
|
||||||
op = operator_map.get(op, op)
|
|
||||||
if op == 'dec':
|
if op == 'dec':
|
||||||
# Support decrement by flipping a positive value's sign
|
# Support decrement by flipping a positive value's sign
|
||||||
# and using 'inc'
|
# and using 'inc'
|
||||||
value = -value
|
value = -value
|
||||||
|
# If operator doesn't found from operator map, op value will stay
|
||||||
|
# unchanged
|
||||||
|
op = operator_map.get(op, op)
|
||||||
|
|
||||||
match = None
|
match = None
|
||||||
if parts[-1] in COMPARISON_OPERATORS:
|
if parts[-1] in COMPARISON_OPERATORS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user