This PR updates mongoengine from 0.15.0 to 0.20.0.
Changelog
### 0.20.0
```
=================
- ATTENTION: Drop support for Python2
- Add Mongo 4.0 to Travis
- Fix error when setting a string as a ComplexDateTimeField 2253
- Bump development Status classifier to Production/Stable 2232
- Improve Queryset.get to avoid confusing MultipleObjectsReturned message in case multiple match are found 630
- Fixed a bug causing inaccurate query results, while combining ``__raw__`` and regular filters for the same field 2264
- Add support for the `elemMatch` projection operator in .fields() (e.g BlogPost.objects.fields(elemMatch__comments="test")) 2267
- DictField validate failed without default connection (bug introduced in 0.19.0) 2239
- Remove methods that were deprecated years ago:
- name parameter in Field constructor e.g `StringField(name="...")`, was replaced by db_field
- Queryset.slave_okay() was deprecated since pymongo3
- dropDups was dropped with MongoDB3
- ``Queryset._ensure_indexes`` and ``Queryset.ensure_indexes``, the right method to use is ``Document.ensure_indexes``
- Added pre-commit for development/CI 2212
- Renamed requirements-lint.txt to requirements-dev.txt 2212
- Support for setting ReadConcern 2255
```
### 0.19.1
```
=================
- Requires Pillow < 7.0.0 as it dropped Python2 support
- DEPRECATION: The interface of ``QuerySet.aggregate`` method was changed, it no longer takes an unpacked list of
pipeline steps (*pipeline) but simply takes the pipeline list just like ``pymongo.Collection.aggregate`` does. 2079
```
### 0.19.0
```
=================
- BREAKING CHANGE: ``class_check`` and ``read_preference`` keyword arguments are no longer available when filtering a ``QuerySet``. 2112
- Instead of ``Doc.objects(foo=bar, read_preference=...)`` use ``Doc.objects(foo=bar).read_preference(...)``.
- Instead of ``Doc.objects(foo=bar, class_check=False)`` use ``Doc.objects(foo=bar).clear_cls_query(...)``.
- This change also renames the private ``QuerySet._initial_query`` attribute to ``_cls_query``.
- BREAKING CHANGE: Removed the deprecated ``format`` param from ``QuerySet.explain``. 2113
- BREAKING CHANGE: Renamed ``MongoEngineConnectionError`` to ``ConnectionFailure``. 2111
- 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.
- BREAKING CHANGE: A ``LazyReferenceField`` is now stored in the ``_data`` field of its parent as a ``DBRef``, ``Document``, or ``EmbeddedDocument`` (``ObjectId`` is no longer allowed). 2182
- DEPRECATION: ``Q.empty`` & ``QNode.empty`` are marked as deprecated and will be removed in a next version of MongoEngine. 2210
- Added ability to check if Q or QNode are empty by parsing them to bool.
- Instead of ``Q(name="John").empty`` use ``not Q(name="John")``.
- Fix updating/modifying/deleting/reloading a document that's sharded by a field with ``db_field`` specified. 2125
- Only set no_cursor_timeout when requested (fixes an incompatibility with MongoDB 4.2) 2148
- ``ListField`` now accepts an optional ``max_length`` parameter. 2110
- Improve error message related to InvalidDocumentError 2180
- Added BulkWriteError to replace NotUniqueError which was misleading in bulk write insert 2152
- Added ability to compare Q and Q operations 2204
- Added ability to use a db alias on query_counter 2194
- Added ability to specify collations for querysets with ``Doc.objects.collation`` 2024
- Fix updates of a list field by negative index 2094
- Switch from nosetest to pytest as test runner 2114
- The codebase is now formatted using ``black``. 2109
- Documentation improvements:
- Documented how `pymongo.monitoring` can be used to log all queries issued by MongoEngine to the driver.
```
### 0.18.2
```
=================
- Replace deprecated PyMongo v2.x methods with their v3.x equivalents in the ``SequenceField``. 2097
- Various code clarity and documentation improvements.
```
### 0.18.1
```
=================
- Fix a bug introduced in 0.18.0 which was causing ``Document.save`` to update all the fields instead of updating only the modified fields. This bug only occurred when using a custom PK. 2082
- Add Python 3.7 to Travis CI. 2058
```
### 0.18.0
```
=================
- Drop support for EOL'd MongoDB v2.6, v3.0, and v3.2.
- MongoEngine now requires PyMongo >= v3.4. Travis CI now tests against MongoDB v3.4 – v3.6 and PyMongo v3.4 – v3.6. 2017 2066
- Improve performance by avoiding a call to ``to_mongo`` in ``Document.save``. 2049
- Connection/disconnection improvements:
- Expose ``mongoengine.connection.disconnect`` and ``mongoengine.connection.disconnect_all``.
- Fix disconnecting. 566 1599 605 607 1213 565
- Improve documentation of ``connect``/``disconnect``.
- Fix issue when using multiple connections to the same mongo with different credentials. 2047
- ``connect`` fails immediately when db name contains invalid characters. 2031 1718
- Fix the default write concern of ``Document.save`` that was overwriting the connection write concern. 568
- Fix querying on ``List(EmbeddedDocument)`` subclasses fields. 1961 1492
- Fix querying on ``(Generic)EmbeddedDocument`` subclasses fields. 475
- Fix ``QuerySet.aggregate`` so that it takes limit and skip value into account. 2029
- Generate unique indices for ``SortedListField`` and ``EmbeddedDocumentListFields``. 2020
- BREAKING CHANGE: Changed the behavior of a custom field validator (i.e ``validation`` parameter of a ``Field``). It is now expected to raise a ``ValidationError`` instead of returning ``True``/``False``. 2050
- BREAKING CHANGES (associated with connection/disconnection fixes):
- Calling ``connect`` 2 times with the same alias and different parameter will raise an error (should call ``disconnect`` first).
- ``disconnect`` now clears ``mongoengine.connection._connection_settings``.
- ``disconnect`` now clears the cached attribute ``Document._collection``.
- BREAKING CHANGE: ``EmbeddedDocument.save`` & ``.reload`` no longer exist. 1552
```
### 0.17.0
```
=================
- POTENTIAL BREAKING CHANGE: All result fields are now passed, including internal fields (``_cls``, ``_id``) when using ``QuerySet.as_pymongo``. 1976
- Document a BREAKING CHANGE introduced in 0.15.3 and not reported at that time. 1995
- DEPRECATION: ``EmbeddedDocument.save`` & ``.reload`` are marked as deprecated and will be removed in a next version of MongoEngine. 1552
- Fix ``QuerySet.only`` working improperly after using ``QuerySet.count`` of the same instance of a ``QuerySet``.
- Fix ``batch_size`` that was not copied when cloning a ``QuerySet`` object. 2011
- Fix ``InvalidStringData`` error when using ``modify`` on a ``BinaryField``. 1127
- Fix test suite and CI to support MongoDB v3.4. 1445
- Fix reference fields querying the database on each access if value contains orphan DBRefs.
```
### 0.16.3
```
=================
- Fix ``$push`` with the ``$position`` operator not working with lists in embedded documents. 1965
```
### 0.16.2
```
=================
- Fix ``Document.save`` that fails when called with ``write_concern=None`` (regression of 0.16.1). 1958
```
### 0.16.1
```
=================
- Fix ``_cls`` that is not set properly in the ``Document`` constructor (regression). 1950
- Fix a bug in the ``_delta`` method - update of a ``ListField`` depends on an unrelated dynamic field update. 1733
- Remove PyMongo's deprecated ``Collection.save`` method and use ``Collection.insert_one`` instead. 1899
```
### 0.16.0
```
=================
- POTENTIAL BREAKING CHANGES:
- ``EmbeddedDocumentField`` will no longer accept references to Document classes in its constructor. 1661
- Get rid of the ``basecls`` parameter from the ``DictField`` constructor (dead code). 1876
- Default value of the ``ComplexDateTime`` field is now ``None`` (and no longer the current datetime). 1368
- Fix an unhashable ``TypeError`` when referencing a ``Document`` with a compound key in an ``EmbeddedDocument``. 1685
- Fix a bug where an ``EmbeddedDocument`` with the same id as its parent would not be tracked for changes. 1768
- Fix the fact that a bulk ``QuerySet.insert`` was not setting primary keys of inserted document instances. 1919
- Fix a bug when referencing an abstract class in a ``ReferenceField``. 1920
- Allow modifications to the document made in ``pre_save_post_validation`` to be taken into account. 1202
- Replace MongoDB v2.4 tests in Travis CI with MongoDB v3.2. 1903
- Fix side effects of using ``QuerySet.no_dereference`` on other documents. 1677
- Fix ``TypeError`` when using lazy Django translation objects as translated choices. 1879
- Improve Python 2-3 codebase compatibility. 1889
- Fix support for changing the default value of the ``ComplexDateTime`` field. 1368
- Improve error message in case an ``EmbeddedDocumentListField`` receives an ``EmbeddedDocument`` instance instead of a list. 1877
- Fix the ``inc`` and ``dec`` operators for the ``DecimalField``. 1517 1320
- Ignore ``killcursors`` queries in ``query_counter`` context manager. 1869
- Fix the fact that ``query_counter`` was modifying the initial profiling level in case it was != 0. 1870
- Repair the ``no_sub_classes`` context manager + fix the fact that it was swallowing exceptions. 1865
- Fix index creation error that was swallowed by ``hasattr`` under Python 2. 1688
- ``QuerySet.limit`` function behaviour: Passing 0 as parameter will return all the documents in the cursor. 1611
- Bulk insert updates the IDs of the input documents instances. 1919
- Fix a harmless bug related to ``GenericReferenceField`` where modifications in the generic-referenced document were tracked in the parent. 1934
- Improve validation of the ``BinaryField``. 273
- Implement lazy regex compiling in Field classes to improve ``import mongoengine`` performance. 1806
- Update ``GridFSProxy.__str__`` so that it would always print both the filename and grid_id. 710
- Add ``__repr__`` to ``Q`` and ``QCombination`` classes. 1843
- Fix bug in the ``BaseList.__iter__`` operator (was occuring when modifying a BaseList while iterating over it). 1676
- Add a ``DateField``. 513
- Various improvements to the documentation.
- Various code quality improvements.
```
### 0.15.3
```
=================
- ``Queryset.update/update_one`` methods now return an ``UpdateResult`` when ``full_result=True`` is provided and no longer a dict. 1491
- Improve ``LazyReferenceField`` and ``GenericLazyReferenceField`` with nested fields. 1704
- Fix the subfield resolve error in ``generic_emdedded_document`` query. 1651 1652
- Use each modifier only with ``$position``. 1673 1675
- Fix validation errors in the ``GenericEmbeddedDocumentField``. 1067
- Update cached fields when a ``fields`` argument is given. 1712
- Add a ``db`` parameter to ``register_connection`` for compatibility with ``connect``.
- Use PyMongo v3.x's ``insert_one`` and ``insert_many`` in ``Document.insert``. 1491
- Use PyMongo v3.x's ``update_one`` and ``update_many`` in ``Document.update`` and ``QuerySet.update``. 1491
- Fix how ``reload(fields)`` affects changed fields. 1371
- Fix a bug where the read-only access to the database fails when trying to create indexes. 1338
```
Links
- PyPI: https://pypi.org/project/mongoengine
- Changelog: https://pyup.io/changelogs/mongoengine/
- Repo: https://github.com/MongoEngine/mongoengine/tarball/master
- Homepage: http://mongoengine.org/
This PR updates mongoengine from 0.15.0 to 0.20.0.
Changelog
### 0.20.0 ``` ================= - ATTENTION: Drop support for Python2 - Add Mongo 4.0 to Travis - Fix error when setting a string as a ComplexDateTimeField 2253 - Bump development Status classifier to Production/Stable 2232 - Improve Queryset.get to avoid confusing MultipleObjectsReturned message in case multiple match are found 630 - Fixed a bug causing inaccurate query results, while combining ``__raw__`` and regular filters for the same field 2264 - Add support for the `elemMatch` projection operator in .fields() (e.g BlogPost.objects.fields(elemMatch__comments="test")) 2267 - DictField validate failed without default connection (bug introduced in 0.19.0) 2239 - Remove methods that were deprecated years ago: - name parameter in Field constructor e.g `StringField(name="...")`, was replaced by db_field - Queryset.slave_okay() was deprecated since pymongo3 - dropDups was dropped with MongoDB3 - ``Queryset._ensure_indexes`` and ``Queryset.ensure_indexes``, the right method to use is ``Document.ensure_indexes`` - Added pre-commit for development/CI 2212 - Renamed requirements-lint.txt to requirements-dev.txt 2212 - Support for setting ReadConcern 2255 ``` ### 0.19.1 ``` ================= - Requires Pillow < 7.0.0 as it dropped Python2 support - DEPRECATION: The interface of ``QuerySet.aggregate`` method was changed, it no longer takes an unpacked list of pipeline steps (*pipeline) but simply takes the pipeline list just like ``pymongo.Collection.aggregate`` does. 2079 ``` ### 0.19.0 ``` ================= - BREAKING CHANGE: ``class_check`` and ``read_preference`` keyword arguments are no longer available when filtering a ``QuerySet``. 2112 - Instead of ``Doc.objects(foo=bar, read_preference=...)`` use ``Doc.objects(foo=bar).read_preference(...)``. - Instead of ``Doc.objects(foo=bar, class_check=False)`` use ``Doc.objects(foo=bar).clear_cls_query(...)``. - This change also renames the private ``QuerySet._initial_query`` attribute to ``_cls_query``. - BREAKING CHANGE: Removed the deprecated ``format`` param from ``QuerySet.explain``. 2113 - BREAKING CHANGE: Renamed ``MongoEngineConnectionError`` to ``ConnectionFailure``. 2111 - 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. - BREAKING CHANGE: A ``LazyReferenceField`` is now stored in the ``_data`` field of its parent as a ``DBRef``, ``Document``, or ``EmbeddedDocument`` (``ObjectId`` is no longer allowed). 2182 - DEPRECATION: ``Q.empty`` & ``QNode.empty`` are marked as deprecated and will be removed in a next version of MongoEngine. 2210 - Added ability to check if Q or QNode are empty by parsing them to bool. - Instead of ``Q(name="John").empty`` use ``not Q(name="John")``. - Fix updating/modifying/deleting/reloading a document that's sharded by a field with ``db_field`` specified. 2125 - Only set no_cursor_timeout when requested (fixes an incompatibility with MongoDB 4.2) 2148 - ``ListField`` now accepts an optional ``max_length`` parameter. 2110 - Improve error message related to InvalidDocumentError 2180 - Added BulkWriteError to replace NotUniqueError which was misleading in bulk write insert 2152 - Added ability to compare Q and Q operations 2204 - Added ability to use a db alias on query_counter 2194 - Added ability to specify collations for querysets with ``Doc.objects.collation`` 2024 - Fix updates of a list field by negative index 2094 - Switch from nosetest to pytest as test runner 2114 - The codebase is now formatted using ``black``. 2109 - Documentation improvements: - Documented how `pymongo.monitoring` can be used to log all queries issued by MongoEngine to the driver. ``` ### 0.18.2 ``` ================= - Replace deprecated PyMongo v2.x methods with their v3.x equivalents in the ``SequenceField``. 2097 - Various code clarity and documentation improvements. ``` ### 0.18.1 ``` ================= - Fix a bug introduced in 0.18.0 which was causing ``Document.save`` to update all the fields instead of updating only the modified fields. This bug only occurred when using a custom PK. 2082 - Add Python 3.7 to Travis CI. 2058 ``` ### 0.18.0 ``` ================= - Drop support for EOL'd MongoDB v2.6, v3.0, and v3.2. - MongoEngine now requires PyMongo >= v3.4. Travis CI now tests against MongoDB v3.4 – v3.6 and PyMongo v3.4 – v3.6. 2017 2066 - Improve performance by avoiding a call to ``to_mongo`` in ``Document.save``. 2049 - Connection/disconnection improvements: - Expose ``mongoengine.connection.disconnect`` and ``mongoengine.connection.disconnect_all``. - Fix disconnecting. 566 1599 605 607 1213 565 - Improve documentation of ``connect``/``disconnect``. - Fix issue when using multiple connections to the same mongo with different credentials. 2047 - ``connect`` fails immediately when db name contains invalid characters. 2031 1718 - Fix the default write concern of ``Document.save`` that was overwriting the connection write concern. 568 - Fix querying on ``List(EmbeddedDocument)`` subclasses fields. 1961 1492 - Fix querying on ``(Generic)EmbeddedDocument`` subclasses fields. 475 - Fix ``QuerySet.aggregate`` so that it takes limit and skip value into account. 2029 - Generate unique indices for ``SortedListField`` and ``EmbeddedDocumentListFields``. 2020 - BREAKING CHANGE: Changed the behavior of a custom field validator (i.e ``validation`` parameter of a ``Field``). It is now expected to raise a ``ValidationError`` instead of returning ``True``/``False``. 2050 - BREAKING CHANGES (associated with connection/disconnection fixes): - Calling ``connect`` 2 times with the same alias and different parameter will raise an error (should call ``disconnect`` first). - ``disconnect`` now clears ``mongoengine.connection._connection_settings``. - ``disconnect`` now clears the cached attribute ``Document._collection``. - BREAKING CHANGE: ``EmbeddedDocument.save`` & ``.reload`` no longer exist. 1552 ``` ### 0.17.0 ``` ================= - POTENTIAL BREAKING CHANGE: All result fields are now passed, including internal fields (``_cls``, ``_id``) when using ``QuerySet.as_pymongo``. 1976 - Document a BREAKING CHANGE introduced in 0.15.3 and not reported at that time. 1995 - DEPRECATION: ``EmbeddedDocument.save`` & ``.reload`` are marked as deprecated and will be removed in a next version of MongoEngine. 1552 - Fix ``QuerySet.only`` working improperly after using ``QuerySet.count`` of the same instance of a ``QuerySet``. - Fix ``batch_size`` that was not copied when cloning a ``QuerySet`` object. 2011 - Fix ``InvalidStringData`` error when using ``modify`` on a ``BinaryField``. 1127 - Fix test suite and CI to support MongoDB v3.4. 1445 - Fix reference fields querying the database on each access if value contains orphan DBRefs. ``` ### 0.16.3 ``` ================= - Fix ``$push`` with the ``$position`` operator not working with lists in embedded documents. 1965 ``` ### 0.16.2 ``` ================= - Fix ``Document.save`` that fails when called with ``write_concern=None`` (regression of 0.16.1). 1958 ``` ### 0.16.1 ``` ================= - Fix ``_cls`` that is not set properly in the ``Document`` constructor (regression). 1950 - Fix a bug in the ``_delta`` method - update of a ``ListField`` depends on an unrelated dynamic field update. 1733 - Remove PyMongo's deprecated ``Collection.save`` method and use ``Collection.insert_one`` instead. 1899 ``` ### 0.16.0 ``` ================= - POTENTIAL BREAKING CHANGES: - ``EmbeddedDocumentField`` will no longer accept references to Document classes in its constructor. 1661 - Get rid of the ``basecls`` parameter from the ``DictField`` constructor (dead code). 1876 - Default value of the ``ComplexDateTime`` field is now ``None`` (and no longer the current datetime). 1368 - Fix an unhashable ``TypeError`` when referencing a ``Document`` with a compound key in an ``EmbeddedDocument``. 1685 - Fix a bug where an ``EmbeddedDocument`` with the same id as its parent would not be tracked for changes. 1768 - Fix the fact that a bulk ``QuerySet.insert`` was not setting primary keys of inserted document instances. 1919 - Fix a bug when referencing an abstract class in a ``ReferenceField``. 1920 - Allow modifications to the document made in ``pre_save_post_validation`` to be taken into account. 1202 - Replace MongoDB v2.4 tests in Travis CI with MongoDB v3.2. 1903 - Fix side effects of using ``QuerySet.no_dereference`` on other documents. 1677 - Fix ``TypeError`` when using lazy Django translation objects as translated choices. 1879 - Improve Python 2-3 codebase compatibility. 1889 - Fix support for changing the default value of the ``ComplexDateTime`` field. 1368 - Improve error message in case an ``EmbeddedDocumentListField`` receives an ``EmbeddedDocument`` instance instead of a list. 1877 - Fix the ``inc`` and ``dec`` operators for the ``DecimalField``. 1517 1320 - Ignore ``killcursors`` queries in ``query_counter`` context manager. 1869 - Fix the fact that ``query_counter`` was modifying the initial profiling level in case it was != 0. 1870 - Repair the ``no_sub_classes`` context manager + fix the fact that it was swallowing exceptions. 1865 - Fix index creation error that was swallowed by ``hasattr`` under Python 2. 1688 - ``QuerySet.limit`` function behaviour: Passing 0 as parameter will return all the documents in the cursor. 1611 - Bulk insert updates the IDs of the input documents instances. 1919 - Fix a harmless bug related to ``GenericReferenceField`` where modifications in the generic-referenced document were tracked in the parent. 1934 - Improve validation of the ``BinaryField``. 273 - Implement lazy regex compiling in Field classes to improve ``import mongoengine`` performance. 1806 - Update ``GridFSProxy.__str__`` so that it would always print both the filename and grid_id. 710 - Add ``__repr__`` to ``Q`` and ``QCombination`` classes. 1843 - Fix bug in the ``BaseList.__iter__`` operator (was occuring when modifying a BaseList while iterating over it). 1676 - Add a ``DateField``. 513 - Various improvements to the documentation. - Various code quality improvements. ``` ### 0.15.3 ``` ================= - ``Queryset.update/update_one`` methods now return an ``UpdateResult`` when ``full_result=True`` is provided and no longer a dict. 1491 - Improve ``LazyReferenceField`` and ``GenericLazyReferenceField`` with nested fields. 1704 - Fix the subfield resolve error in ``generic_emdedded_document`` query. 1651 1652 - Use each modifier only with ``$position``. 1673 1675 - Fix validation errors in the ``GenericEmbeddedDocumentField``. 1067 - Update cached fields when a ``fields`` argument is given. 1712 - Add a ``db`` parameter to ``register_connection`` for compatibility with ``connect``. - Use PyMongo v3.x's ``insert_one`` and ``insert_many`` in ``Document.insert``. 1491 - Use PyMongo v3.x's ``update_one`` and ``update_many`` in ``Document.update`` and ``QuerySet.update``. 1491 - Fix how ``reload(fields)`` affects changed fields. 1371 - Fix a bug where the read-only access to the database fails when trying to create indexes. 1338 ```Links
- PyPI: https://pypi.org/project/mongoengine - Changelog: https://pyup.io/changelogs/mongoengine/ - Repo: https://github.com/MongoEngine/mongoengine/tarball/master - Homepage: http://mongoengine.org/