Django MongoDB Backend 5.2.x

5.2.3

Unreleased

New features

Bug fixes

  • Prevented QuerySet.union() queries from duplicating the $project pipeline.

5.2.2

October 22, 2025

This release confirms support for Python 3.14. No code changes were required.

New features

  • SearchIndex's new field_mappings, analyzer, and search_analyzer arguments allow creating more complex indexes.

Bug fixes

  • Fixed a KeyError crash when loading models with EmbeddedModel fields 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 existing EmbeddedModel).

  • Made EmbeddedModel fields respect db_column.

  • Corrected the search index type of EmbeddedModelField and PolymorphicEmbeddedModelField from embeddedDocuments to document.

  • 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 $expr where possible, so that they can use indexes.

Deprecated features

  • django_mongodb_backend.utils.parse_uri() is deprecated in favor of putting the connection string in DATABASES["HOST"]. See the deprecation timeline for upgrade instructions.

5.2.1

September 8, 2025

New features

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 $lte use $match instead of $expr so 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, and iregex) no longer support non-string fields. These lookups previously cast their input using $toString but 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

Backwards incompatible changes

  • django.db.models.SmallIntegerField and django.db.models.PositiveSmallIntegerField are 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 pickle encoding of cached values a vulnerability. If an attacker compromises the database, they could run arbitrary commands on the application server.

Bug fixes

Performance improvements

  • Improved QuerySet performance by removing low limit on server-side chunking.

  • Improved QuerySet join ($lookup) performance by pushing some simple conditions from the WHERE ($match) clause to the $lookup stage.

5.2.0 beta 1

June 4, 2025

New features

Bug fixes

  • Fixed crash when loading models with a null value for ArrayFields where the base_field uses 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.

Backwards incompatible changes

  • The minimum supported version of pymongo is increased from 4.6 to 4.7.

  • The conn_max_age parameter of parse_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’s contains, contained__by, len, etc.

  • Fixed the results of queries that use the tzinfo parameter of the Trunc database functions.

  • Added support for QuerySet.dates() and datetimes().

  • Fixed loading of QuerySet results for embedded models that have fields that use database converters. For example, a crash for DecimalField: ValidationError: ['“1” value must be a decimal number.']).