Fix bug #1965 of $position and $push operators do not work with list in an EmbeddedDocument. Set key value to joined parts excluding the index at the end. Added test case

This commit is contained in:
Trevor Hall
2018-12-05 20:18:48 -06:00
parent bdd6041a5c
commit 352b23331b
3 changed files with 19 additions and 2 deletions

View File

@@ -345,7 +345,7 @@ def update(_doc_cls=None, **update):
value = {key: {'$each': value}}
elif op in ('push', 'pushAll'):
if parts[-1].isdigit():
key = parts[0]
key = '.'.join(parts[0:-1])
position = int(parts[-1])
# $position expects an iterable. If pushing a single value,
# wrap it in a list.