Merge pull request #1636 from erdenezul/fix_shard_key_modify
Fix Document.modify fail on sharded collection #1569
This commit is contained in:
		| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user