Fix Document.modify fail on sharded collection #1569
This commit is contained in:
parent
0325a62f18
commit
1eae97731f
@ -280,6 +280,9 @@ class Document(BaseDocument):
|
|||||||
elif query[id_field] != self.pk:
|
elif query[id_field] != self.pk:
|
||||||
raise InvalidQueryError('Invalid document modify query: it must modify only this document.')
|
raise InvalidQueryError('Invalid document modify query: it must modify only this document.')
|
||||||
|
|
||||||
|
# Need to add shard key to query, or you get an error
|
||||||
|
query.update(self._object_key)
|
||||||
|
|
||||||
updated = self._qs(**query).modify(new=True, **update)
|
updated = self._qs(**query).modify(new=True, **update)
|
||||||
if updated is None:
|
if updated is None:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user