4. Changelog
4.1. Changes in v0.29.0
- Fix weakref in EmbeddedDocumentListField (causing brief mem leak in certain circumstances) #2827
- Fix pillow deprecation warning related with LANCZOS filter #2824
- Allow gt/gte/lt/lte/ne operators to be used with a list as value on ListField #2813
- Switch tox to use pytest instead of legacy
python setup.py test #2804
- Add support for timeseries collection #2661
- Add support in tests for MongoDB 7.0, pymongo 4.7 and pymongo 4.8 in the CI #2826
- Add support for
array_filters in Queryset.modify #2811
- Integrate a docker-compose setup for local testing #2555
- Improve ReferenceField wrong usage detection
- Fix no_dereference thread-safetyness #2830
- BREAKING CHANGE:
max_length in ListField is now keyword only on ListField signature
- BREAKING CHANGE: Force
field argument of ListField/DictField to be a field instance (e.g ListField(StringField()) instead of ListField(StringField))
4.2. Changes in v0.28.2
- Fix typing import incompatible with Pymongo 3.7 #2802
4.3. Changes in v0.28.1
- Fix bug related with recent updates to no_dereference context manager #2799
4.4. Changes in v0.28.0
- Fix for uuidRepresentation not read when provided in URI #2741
- Add option to user array_filters #2769
- Fix combination of
__raw__ and mongoengine syntax #2773
- Add tests against MongoDB 6.0 and MongoDB 7.0 in the pipeline
- Fix validate() not being called when inheritance is used in EmbeddedDocument and validate is overridden #2784
- Add support for readPreferenceTags in connection parameters #2644
- Use
estimated_documents_count OR documents_count when count is called, based on the query #2529
- Fix no_dereference context manager which wasn't turning off auto-dereferencing correctly in some cases #2788
- BREAKING CHANGE: no_dereference context manager no longer returns the class in
__enter__. It must be called like with no_dereference(User): and no longer with no_dereference(User) as ...: #2788
- Added
__raw__ to Queryset.order_by() to allow providing raw pymongo 'sort' argument #2783
- Add
text_score argument on Document.search_text() to allow text_score computation to be turned off #2759
4.5. Changes in v0.27.0
- Update uuidRepresentation warnings with "unspecified" as the future default #2739
- Added
mongo_client_class optional parameter to connect() to allow use of an alternative mongo client than pymongo.MongoClient. Typically to support mock mongo libraries like mongomock, montydb, mongita #2729
- BREAKING CHANGE: Connecting MongoEngine with mongomock should now use the new
mongo_client_class. For more info, check the mongomock guide
- Fix DictField that always gets marked as changed #2606
- Fix for
Queryset.none() that has no effect on update/aggregate/first #2669
4.6. Changes in v0.26.0
- BREAKING CHANGE: Improved the performance of
save() by removing the call to ensure_indexes unless meta['auto_create_index_on_save'] is set to True
- Added meta
auto_create_index_on_save so you can enable index creation on save()
- BREAKING CHANGE: Remove deprecated method
ensure_index (replaced by create_index long time ago)
- Addition of
Decimal128Field for accurate representation of Decimals
- BREAKING CHANGE: When using
ListField(EnumField) or DictField(EnumField), the values weren't always cast into the Enum #2531
- BREAKING CHANGE (bugfix): Querying
ObjectIdField or ComplexDateTimeField with None no longer raises a ValidationError #2681
- Allow updating a field that has an operator name e.g. "type" with
.update(set__type="foo") #2595
- Support MONGODB-AWS authentication mechanism (with authmechanismproperties) #2507
- Bug Fix - distinct query doesn't obey the
no_dereference() #2663
- Fix Document.compare_indexes() not working correctly for text indexes on multiple fields #2612
- Add support for transaction through
run_in_transaction #2569
4.7. Changes in v0.25.0
- Support MONGODB-AWS authentication mechanism (with
authmechanismproperties) #2507
- Bug Fix - distinct query doesn't obey the
no_dereference() #2663
- Add tests against Mongo 5.0 in pipeline
- Drop support for Python 3.6 (EOL)
- Bug fix support for PyMongo>=4 to fix "pymongo.errors.InvalidOperation: Cannot use MongoClient after close" errors #2627
4.8. Changes in v0.24.2
- Bug fix regarding uuidRepresentation that was case sensitive #2650
4.9. Changes in v0.24.1
- Allow pymongo<5.0 to be pulled
- Don't use deprecated property for emptiness check in queryset base #2633
4.10. Changes in v0.24.0
- EnumField improvements: now
choices limits the values of an enum
- Fix bug that prevented instance queryset from using custom
queryset_class #2589
- Fix deepcopy of EmbeddedDocument #2202
- Introduce a base exception class for MongoEngine exceptions (
MongoEngineException) #2515
- Fix error when using
precision=0 with DecimalField #2535
- Add support for regex and whole word text search query #2568
- Add support for update aggregation pipeline #2578
- BREAKING CHANGE: Updates to support pymongo 4.0. See the PyMongo 4.0 migration guide #2614
4.11. Changes in v0.23.1
- Bug fix: ignore LazyReferenceFields when clearing
_changed_fields #2484
- Improve connection doc #2481
4.12. Changes in v0.23.0
- Bugfix: manually setting SequenceField in DynamicDocument doesn't increment the counter #2471
- Add MongoDB 4.2 and 4.4 to CI
- Add support for allowDiskUse on querysets #2468
4.13. Changes in v0.22.1
- Declare that Py3.5 is not supported in package metadata #2449
- Moved CI from Travis to Github-Actions
4.14. Changes in v0.22.0
- Fix LazyReferenceField dereferencing in embedded documents #2426
- Fix regarding the recent use of
Cursor.__spec in .count() that was interfering with mongomock #2425
- Drop support for Python 3.5 by introducing f-strings in the codebase
4.15. Changes in v0.21.0
- Bug fix in DynamicDocument which is not parsing known fields in constructor like Document does #2412
- When using pymongo >= 3.7, make use of
Collection.count_documents instead of deprecated Collection.count
- Fix a bug that made the queryset drop the
read_preference after clone()
- Remove Py3.5 from CI as it reached EOL and add Python 3.9
- Fix some issues related with db_field/field conflict in constructor #2414
- BREAKING CHANGE: Fix the behavior of
Doc.objects.limit(0) which should return all documents (similar to MongoDB) #2311
- Bug fix in ListField when updating the first item #2392
- Add EnumField:
mongoengine.fields.EnumField
- Bug Fix:
Document.save() fails when shard_key is not _id #2154
4.16. Changes in v0.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 #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() #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, Queryset.slave_okay(), dropDups, Queryset._ensure_indexes
- Support for setting ReadConcern #2255
4.17. Changes in v0.19.1
- Tests require 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 but simply takes the pipeline list #2079
4.18. Changes in v0.19.0
- BREAKING CHANGE:
class_check and read_preference keyword arguments are no longer available when filtering a QuerySet #2112
- BREAKING CHANGE: Removed the deprecated
format param from QuerySet.explain #2113
- BREAKING CHANGE: Renamed
MongoEngineConnectionError to ConnectionFailure #2111
- BREAKING CHANGE: Positional arguments when instantiating a document are no longer supported #2103
- BREAKING CHANGE: A
LazyReferenceField is now stored in the _data field of its parent as a DBRef, Document, or EmbeddedDocument #2182
- DEPRECATION:
Q.empty & QNode.empty are marked as deprecated #2210
- 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
- Added
BulkWriteError to replace misleading NotUniqueError in bulk write insert #2152
- Added ability to specify collations for querysets with
Doc.objects.collation #2024
- The codebase is now formatted using
black #2109
4.19. Changes in v0.18.2
- Fix side effects of using
QuerySet.no_dereference on other documents #1677
- Fix TypeError when using lazy Django translation objects as translated choices #1879
- Fix support for changing the default value of the ComplexDateTime field #1368
- Fix the inc and dec operators for the DecimalField #1517
4.20. Changes in v0.18.1
- 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
- Add
LazyReferenceField and GenericLazyReferenceField #1230
4.21. Changes in v0.18.0
- POTENTIAL BREAKING CHANGE: All result fields are now passed, including internal fields (
_cls, _id) when using QuerySet.as_pymongo #1976
- DEPRECATION:
EmbeddedDocument.save & .reload are marked as deprecated #1552
- Fix
QuerySet.only working improperly after using QuerySet.count of the same instance #2011
- Fix batch_size that was not copied when cloning a QuerySet object
- Fix
$push with the $position operator not working with lists in embedded documents
4.22. Changes in v0.17.0
- POTENTIAL BREAKING CHANGE: Make EmbeddedDocument not hashable by default #1528
- POTENTIAL BREAKING CHANGE: Added Unicode support to the EmailField
- POTENTIAL BREAKING CHANGE: Fix limit/skip/hint/batch_size chaining
- BREAKING CHANGE: Remove the coerce_types param from
QuerySet.as_pymongo #1549
- Fix how
reload(fields) affects changed fields #1371
4.23. Changes in v0.16.3
- Fix ListField minus index assignment not working #1119
- Fix cascade delete mixing among collections #1224
- Add
signal_kwargs argument to Document.save, Document.delete and BaseQuerySet.insert #1206
4.24. Changes in v0.16.2
- Fix a no_cursor_timeout error with PyMongo v3.x #1304
- Replace map-reduce based
QuerySet.sum/average with aggregation-based implementations #1336
4.25. Changes in v0.16.1
- BREAKING CHANGE: Rename
ConnectionError to MongoEngineConnectionError since the former is a built-in exception name in Python v3.x #1428
- BREAKING CHANGE: Drop Python v2.6 support #1428
- Fix connecting to a replica set with PyMongo 2.x #1436
- Fix using sets in field choices #1481
- Fix deleting items from a ListField #1318
- Add a rename update operator #1454
- Raise an error when trying to save an abstract document #1449
4.26. Changes in v0.16.0
- Add support for pickling QuerySet instances #1397
- Fix connecting to a list of hosts #1389
- Add support for mocking MongoEngine based on mongomock #1151
- Allow creation of sparse compound indexes #1114
- SaveConditionError is now importable from the top level package
4.27. Changes in v0.15.3
- BREAKING CHANGE: EmbeddedDocument.save & .reload no longer exist #1552
- Fix QuerySet.only working improperly after using QuerySet.count #2011
- Fix InvalidStringData error when using modify on a BinaryField #1127
4.28. Changes in v0.15.0
- Add support for
Document.modify() and QuerySet.modify() to provide find_and_modify() like behaviour #677
- Added support for the
using() method on a queryset #676
- Fixed a few instances where
reverse_delete_rule was written as reverse_delete_rules #791
- Added support for multiple slices and made slicing chainable #170
4.29. Changes in v0.14.3
- Querying by a field defined in a subclass raises
InvalidQueryError #744
- Removing support for Django 1.4.x, pymongo 2.5.x, pymongo 2.6.x
4.30. Changes in v0.14.0
- Added queryset_manager functions that now accept two arguments – the document class as the first and the queryset as the second
- Fixed bug where QuerySet.exec_js ignored Q objects
- Added field name substitution for Javascript code
4.31. Changes in v0.13.0
- BREAKING CHANGE: remove deprecated method
ensure_index (replaced by create_index long time ago)
- Addition of
Decimal128Field
- BREAKING CHANGE: When using
ListField(EnumField) or DictField(EnumField), values weren't always cast into the Enum #2531
4.32. Changes in v0.12.0
- QuerySet.modify() and Document.modify() methods to provide find_and_modify() like behaviour #677 #773
- Added support for the
using() method on a queryset #676
4.33. Changes in v0.11.0
- Added
contains, startswith and endswith query operators (and case-insensitive versions prefixed with 'i')
- Deprecated fields'
name parameter, replaced with db_field
- Improve Python 2-3 codebase compatibility
4.34. Changes in v0.10.9
- Fix connecting to a replica set with PyMongo 2.x #1436
- Fix using sets in field choices #1481
4.35. Changes in v0.10.8
- BREAKING CHANGE: Rename
ConnectionError to MongoEngineConnectionError #1428
- Fix an obscure error message when filtering by
field__in=non_iterable #1237
- Add a rename update operator #1454
4.36. Changes in v0.10.7
- Add
signal_kwargs argument to Document.save, Document.delete and BaseQuerySet.insert to be passed to signals calls #1206
- Raise
OperationError when trying to do a drop_collection on document with no collection set
- Fix LongField values stored as int32 in Python 3 #1253
- MapField now handles unicode keys correctly #1267
- ListField now handles negative indices correctly #1270
4.37. Changes in v0.10.6
- Add support for pickling QuerySet instances #1397
- Fix connecting to a list of hosts #1389
- Add support for mocking MongoEngine based on mongomock #1151
4.38. Changes in v0.10.5
- Fix a no_cursor_timeout error with PyMongo v3.x #1304
- Replace map-reduce based
QuerySet.sum/average with aggregation-based implementations #1336
- Fix support for
__ to escape field names that match operators' names in update #1351
4.39. Changes in v0.10.4
- Fix ListField minus index assignment not working #1119
- Remove code that marks a field as changed when the field has a default value but does not exist in the database #1126
- Recursively build a query when using the elemMatch operator #1130
- Django support was removed and will be available as a separate extension #958
- Allow to load undeclared field with meta attribute
'strict': False #957
4.40. Changes in v0.10.3
- Fixed
EmbeddedDocuments with id also storing _id #402
- Added
get_proxy_object helper to filefields #391
4.41. Changes in v0.10.2
- Remove
get_or_create() deprecated since 0.8.0 #300
- Improve
Document._created status when switch collection and db #1020
- Queryset update doesn't go through field validation #453
- Added support for specifying authentication source as option
authSource in URI #967
4.42. Changes in v0.10.1
- Fixed a few instances where
reverse_delete_rule was written as reverse_delete_rules #791
- Added support for multiple slices and made slicing chainable #170 #190 #191
- Fixed index inheritance issues #123 #125
4.43. Changes in v0.10.0
- QuerySet.modify() and Document.modify() methods to provide find_and_modify() like behaviour #677
- Added support for the using() method on a queryset #676
- ReferenceFields with
dbref=False use ObjectId instead of strings #134
4.44. Changes in v0.9.0
- Added
contains, startswith and endswith query operators (and case-insensitive versions)
- Deprecated fields' name parameter, replaced with
db_field
- Added
map_reduce method item_frequencies and set as default
- Updated connection exception so it provides more info on the cause
- Added
creation_counter to BaseField allowing fields to be sorted in the way the user has specified them
4.45. Changes in v0.8.7
- Fixed
EmbeddedDocuments with id also storing _id #402
- Added
get_proxy_object helper to filefields #391
4.46. Changes in v0.8.6
- Fix read_preference (it had chaining issues with PyMongo v2.x and it didn't work at all with PyMongo v3.x) #1042
- Allow shard key to point to a field in an embedded document #551
- ReferenceFields now support abstract document types #837
4.47. Changes in v0.8.5
- Optional
save_condition that only overwrites existing documents if the condition is satisfied in the current db record
- Added
switch_collection context manager
- Document meta now supports
auto_create_index
4.48. Changes in v0.8.4
- Added
no_dereference context manager and queryset method
- ReferenceFields in forms now use
pk instead of id
4.49. Changes in v0.8.3
- Added
switch_db context manager
- Updated ReferenceFields to optionally store ObjectId strings — this will become the default in 0.9
- Added FutureWarning - save will default to
cascade=False in 0.8
4.50. Changes in v0.8.2
- BREAKING CHANGE:
get_or_create no longer supported
- Added
QuerySet.aggregate wrapper
4.51. Changes in v0.8.1
- Saves will raise a FutureWarning if they cascade and cascade hasn't been set to True
- SequenceField now inherits from BaseField to allow flexible storage of the calculated value
4.52. Changes in v0.8.0
- BREAKING CHANGE: inheritance model changed — no longer need to store an array of types, just use the classname in
_cls
- To improve performance, document saves will no longer automatically cascade
- Document and Embedded Documents are now serialized based on declared field order
- SequenceField now inherits from BaseField
- DecimalField improved with addition of precision and rounding
4.53. Changes in v0.7.10
- Signals are now fired on
Document.update
- Added
EmbeddedDocumentField choices
4.54. Changes in v0.7.9
- Added
QuerySet.batch_size
- Fixed
QuerySet.count with limit and skip
4.55. Changes in v0.7.8
- Fixed
DateTimeField so it returns None when None is set
- Updated
URLField validate to use urllib2.urlopen
4.56. Changes in v0.7.7
- Fixed
SequenceField when using SequenceField as the primary key
- Added
reload to EmbeddedDocumentListField
4.57. Changes in v0.7.6
- Added
no_cursor_timeout to QuerySet
- Fixed
DateField and DateTimeField so they don't convert None values
4.58. Changes in v0.7.5
- Fixed
ValidationError with deeply nested documents
- Added
QuerySet.comment
4.59. Changes in v0.7.4
- Added support for indices on
DictField
- Fixed issues with inheritance and
_cls
4.60. Changes in v0.7.3
- Added
FileField to EmbeddedDocuments
- Added
GeoJsonField
4.61. Changes in v0.7.2
- Added
GeoPointField
- Added
SequenceField
4.62. Changes in v0.7.1
- Fixed
ReferenceField bug with dbref=False
- Added
BaseQuerySet.no_dereference
4.63. Changes in v0.7.0
- Added Geo support —
PointField, LineStringField, PolygonField
- Added
SortedListField
- Added
EnumField
4.64. Changes in v0.6.20
- Fixed an issue with
MapField
- Added support for
sparse indexes
4.65. Changes in v0.6.19
- Fixed issue with
EmbeddedDocumentField and invalid data
4.66. Changes in v0.6.18
- Fixed
ReferenceField reverse_delete_rule handling
4.67. Changes in v0.6.17
- Fixed a FutureWarning being shown in Python 3.2+
4.68. Changes in v0.6.16
- Fixed
DynamicDocument not setting dynamic attributes correctly
4.69. Changes in v0.6.15
- Fixed
BinaryField comparison
4.70. Changes in v0.6.14
- Fixed
QuerySet.update not working with ListField(EmbeddedDocumentField)
4.71. Changes in v0.6.13
- Added
Document.compare_indexes()
4.72. Changes in v0.6.12
- Fixed
FileField with inherited documents
4.73. Changes in v0.6.11
- Fixed issue with
DictField containing EmbeddedDocumentField
4.74. Changes in v0.6.10
- Fixed
QuerySet.filter with DictField
4.75. Changes in v0.6.9
4.76. Changes in v0.6.8
- Added
ComplexDateTimeField
4.77. Changes in v0.6.7
4.78. Changes in v0.6.6
4.79. Changes in v0.6.5
- Fixed
BinaryField subclassing
4.80. Changes in v0.6.4
4.81. Changes in v0.6.3
- Fixed GridFS file replacement
4.82. Changes in v0.6.2
4.83. Changes in v0.6.1
- Fixed
QuerySet iteration bug
4.84. Changes in v0.6
- Added GridFS support via
FileField
- Added
EmailField
- Added
GenericReferenceField
4.85. Changes in v0.5.2
- Fixed
DynamicDocument saving
4.86. Changes in v0.5.1
- Fixed issue with
MapField
4.87. Changes in v0.5
- Added
DynamicDocument and DynamicEmbeddedDocument
- Added
signals support
- Added
GeoPointField
- Added
cascade save option
- Document and Embedded Documents serialized based on declared field order
4.88. Changes in v0.4
- Fields may now specify
unique=True to enforce uniqueness across a collection
- Added option for default document ordering
- Fixed bug in index definitions
4.89. Changes in v0.3
- Added
Q class for building advanced queries
- Added
QuerySet methods for atomic updates to documents
- Fields may now specify
unique=True to enforce uniqueness across a collection
- Added option for default document ordering
- Fixed bug in index definitions
4.90. Changes in v0.2.2
- Fixed bug in Document dictionary-style access
- Added
BooleanField
4.91. Changes in v0.2.1
- Query values may be processed before being used in queries
- Made connections lazy
4.92. Changes in v0.2
- Added
Q class for building advanced queries
- Added
QuerySet methods for atomic updates to documents
- Fields may now specify
unique=True to enforce uniqueness across a collection
- Added option for default document ordering
- Fixed bug in index definitions
4.93. Changes in v0.1.3
- Added Django authentication backend
- Added
Document.meta support for indexes, which are ensured just before querying takes place
- A few minor bugfixes
4.94. Changes in v0.1.2
- Query values may be processed before before being used in queries
- Made connections lazy
- Fixed bug in Document dictionary-style access
- Added
BooleanField
- Added
Document.reload() method
4.95. Changes in v0.1.1
- Documents may now use capped collections