Django MongoDB Backend 5.2.x¶
5.2.3¶
Unreleased
New features¶
…
Bug fixes¶
Prevented
QuerySet.union()queries from duplicating the$projectpipeline.
5.2.2¶
October 22, 2025
This release confirms support for Python 3.14. No code changes were required.
New features¶
SearchIndex's newfield_mappings,analyzer, andsearch_analyzerarguments allow creating more complex indexes.
Bug fixes¶
Fixed a
KeyErrorcrash when loading models withEmbeddedModelfields that use a database converter, if the field isn’t present in the data (e.g. data not written by Django, or after a field was added to an existingEmbeddedModel).Made
EmbeddedModelfields respectdb_column.Corrected the search index type of
EmbeddedModelFieldandPolymorphicEmbeddedModelFieldfromembeddedDocumentstodocument.Fixed
transaction.atomic()crash if the database connection isn’t initialized.
Performance improvements¶
Continued the query optimization work started in 5.2.1, making queries avoid using
$exprwhere possible, so that they can use indexes.
Deprecated features¶
django_mongodb_backend.utils.parse_uri()is deprecated in favor of putting the connection string inDATABASES["HOST"]. See the deprecation timeline for upgrade instructions.
5.2.1¶
September 8, 2025
New features¶
Allowed specifying the MongoDB connection string in
DATABASES["HOST"], eliminating the need to useparse_uri()to configure theDATABASESsetting.
Bug fixes¶
Migrations operations that add or delete search indexes now wait until the operation is completed on the server to prevent conflicts when running multiple operations sequentially.
Performance improvements¶
Made simple queries that use
$eq,$in,$and,$or,$gt,$gte,$lt, and/or$lteuse$matchinstead of$exprso that they can use indexes.
5.2.0¶
September 2, 2025
General availability release. No changes since beta 3.
5.2.0 beta 3¶
August 29, 2025
Backwards incompatible changes¶
Pattern matching lookups (
iexact,startswith,istartswith,endswith,iendswith,contains,icontains,regex, andiregex) no longer support non-string fields. These lookups previously cast their input using$toStringbut this caused some queries to perform poorly because MongoDB couldn’t use indexes when running the query.
5.2.0 beta 2¶
August 13, 2025
New features¶
Added support for Atlas Search queries.
Added subquery support for
EmbeddedModelArrayField.Added the
optionsparameter toparse_uri().Added support for database transactions.
Added
PolymorphicEmbeddedModelFieldandPolymorphicEmbeddedModelArrayFieldfor storing a model instance or list of model instances that may be of more than one model class.Added GeoDjango support.
Added Queryable Encryption support.
Backwards incompatible changes¶
django.db.models.SmallIntegerFieldanddjango.db.models.PositiveSmallIntegerFieldare now limited to 32 bit values in forms and model validation.Removed support for database caching as the MongoDB security team considers the cache backend’s
pickleencoding of cached values a vulnerability. If an attacker compromises the database, they could run arbitrary commands on the application server.
Bug fixes¶
Fixed
RecursionErrorwhen usingTruncdatabase functions on non-MongoDB databases.QuerySet.explain()now returns a string that can be parsed as JSON.Fixed unique constraint generation for
IntegerFieldandPositiveBigIntegerField, which incorrectly allowed duplicate values larger than 32 bits. Existing unique constraints must be recreated to use$type: longinstead ofint.IntegerField,BigIntegerField(as well as thePositiveversions of these fields), andDurationFieldvalues are now sent to MongoDB asbson.int64.Int64, which fixes unique constraints on values less than 32 bits forBigIntegerField,PositiveIntegerField, andDurationField. Existing data must be converted toInt64.
Performance improvements¶
Improved
QuerySetperformance by removing low limit on server-side chunking.Improved
QuerySetjoin ($lookup) performance by pushing some simple conditions from theWHERE($match) clause to the$lookupstage.
5.2.0 beta 1¶
June 4, 2025
New features¶
Added
EmbeddedModelArrayFieldfor storing a list of model instances.
Bug fixes¶
Fixed crash when loading models with a null value for
ArrayFields where thebase_fielduses a database converter.
5.2.0 beta 0¶
May 14, 2025
Initial release from the state of django-mongodb-backend 5.1.0 beta 2.
Regarding new features in Django 5.2,
CompositePrimaryKey isn’t supported.
New features¶
These features won’t appear in Django MongoDB Backend 5.1.x.
Added
SearchIndexandVectorSearchIndexfor use on a model’sMeta.indexes.PyMongo’s connection pooling is now used by default. See Connection management.
Backwards incompatible changes¶
The minimum supported version of
pymongois increased from 4.6 to 4.7.The
conn_max_ageparameter ofparse_uri()is removed because persistent connections are now used by default.
Bug fixes¶
Added support for a field’s custom lookups and transforms in
EmbeddedModelField, e.g.ArrayField’scontains,contained__by,len, etc.Fixed the results of queries that use the
tzinfoparameter of theTruncdatabase functions.Added support for
QuerySet.dates()anddatetimes().Fixed loading of
QuerySetresults for embedded models that have fields that use database converters. For example, a crash forDecimalField:ValidationError: ['“1” value must be a decimal number.']).