Fix Document._object_key (#2125)

Previous implementation of `Document._object_key` was *pretending* to work on
MongoEngine-level fields (e.g. using "pk" instead of "_id" and separating
nested field parts by "__" instead of "."), but then it was also attempting to
transform field names from the `shard_key` into DB-level fields.

This, expectedly, didn't really work well. Most of the test cases added in this
commit were failing prior to the code fixes.
This commit is contained in:
Stefan Wójcik
2019-07-09 12:08:26 +02:00
committed by GitHub
parent abe8070c36
commit aa76ccdd25
4 changed files with 82 additions and 14 deletions

View File

@@ -15,8 +15,9 @@ Development
- If you catch/use ``MongoEngineConnectionError`` in your code, you'll have to rename it.
- BREAKING CHANGE: Positional arguments when instantiating a document are no longer supported. #2103
- From now on keyword arguments (e.g. ``Doc(field_name=value)``) are required.
- The codebase is now formatted using ``black``. #2109
- Fix updating/modifying/deleting/reloading a document that's sharded by a field with ``db_field`` specified. #2125
- ``ListField`` now accepts an optional ``max_length`` parameter. #2110
- The codebase is now formatted using ``black``. #2109
Changes in 0.18.2
=================