Learn what's new in:
What's New in 6.0
This section lists the changes introduced in the following patch releases:
Version 6.0.3
The Django MongoDB Backend v6.0.3 release includes the following features, improvements, and fixes:
Adds support for
ObjectIdmatching in URL patterns. To learn more, see URL dispatcher in the API documentation.Prevents the creation of models that have encrypted fields in non-encrypted databases by generating an error when Queryable Encryption is not configured.
Version 6.0.2
The Django MongoDB Backend v6.0.2 release includes the following features, improvements, and fixes:
Adds support for the
QuerySet.intersection()andQuerySet.difference()methods.Adds support for the
nulls_distinctparameter of theUniqueConstraintconstructor, which allows you to store only one document that has aNULLvalue. To learn more, see Specify Unique Constraints in the Create Models guide.Adds the
EmbeddedFieldIndexclass, which enables indexes on subfields ofEmbeddedModelFieldandEmbeddedModelArrayFieldvalues. To learn more, see Embedded Model Subfield Index in the Create Indexes guide.Adds the
EmbeddedFieldUniqueConstraintclass, which enables unique constraints on subfields ofEmbeddedModelFieldandEmbeddedModelArrayFieldvalues. To learn more, see Embedded Field Constraints in the Create Models guide.Fixes a bug that caused an error when calling
Model.save()on models with encrypted fields.
Version 6.0.1
The Django MongoDB Backend v6.0.1 release includes the following features, improvements, and fixes:
Adds support for Queryable Encryption. To learn more, see the Queryable Encryption tutorial.
Adds support for spatial lookups. To learn more, see Query Geospatial Values in the Specify a Query guide.
Prevents
Indexsystem checks from running twice.Adds exception messages to
DatabaseErrorandIntegrityErrorexceptions.Fixes
QuerySet.defer()andQuerySet.only()behavior so that the methods project the correct fields.Removes the use of
$facetfrom aggregation pipelines, which improves query performance.
Version 6.0.0
Warning
Breaking Changes
The Django MongoDB Backend v6.0.0 release the following breaking changes:
Removes support for the
django_mongodb_backend.utils.parse_uri()method. Instead, use theDATABASES["HOST"]key. To learn more, see Automatically Configure Database Settings in the Configure Your Database Connection guide.Increase the minimum supported MongoDB version from 6.0 to 7.0.
What's New in 5.2
This section lists the changes introduced in the following patch releases:
Version 5.2.4
The Django MongoDB Backend v5.2.4 release includes the following features, improvements, and fixes:
Improves the performance of join operations, which use the
$lookupaggregation stage, by pushing complex conditions from the$matchstage to the$lookupstage
Version 5.2.3
The Django MongoDB Backend v5.2.3 release includes the following features, improvements, and fixes:
Prevents
QuerySet.union()queries from duplicating the$projectpipeline stage.Updates the
Valueclass to wrap string, dictionary, and tuple values in the$literaloperator to prevent MongoDB from interpreting them as expressions. Similarly, queries that update models now wrap values in the$literaloperator for the same reason.Simplifies
$lookupqueries by usinglocalFieldandforeignField.
Version 5.2.2
The Django MongoDB Backend v5.2.2 release includes the following features, improvements, and fixes:
Adds the following
SearchIndexarguments, which allow you to create more complex indexes:field_mappingsanalyzersearch_analyzer
To learn more, see Search Indexes in the Indexes guide.
Fixes a
KeyErrorexception that occurred when loading models that containEmbeddedModelfields using a database converter, if the field isn’t present in the data.Ensures that the
db_columnargument applies toEmbeddedModelfields.Corrects the search index type of
EmbeddedModelFieldandPolymorphicEmbeddedModelFieldvalues fromembeddedDocumentstodocument.Fixes the
transaction.atomic()error that occurred when the database connection was not initialized.Deprecates the
django_mongodb_backend.utils.parse_uri()method. This method is removed in a future release.
Version 5.2.1
The Django MongoDB Backend v5.2.1 release includes the following features, improvements, and fixes:
Adds support for specifying the connection string in the
DATABASES["HOST"]key instead of using thedjango_mongodb_backend.utils.parse_uri()method. To learn more, see Automatically Configure Database Settings in the Configure Your Database Connection guide.Instructs migrations operations that add or delete search indexes to wait until the operation is completed on the server, which prevents conflicts when running multiple operations sequentially.
Configures simple queries that use the following operators to use
$matchinstead of$expr, which allows them to use indexes:$eq$in$and$or$gt$gte$lt$lte
Version 5.2.0
Django MongoDB Backend v5.2.0 is the initial general availability (GA) release. To learn more about the GA features, see the Django MongoDB Backend Now Generally Available blog post.
Version 5.2.0 beta 3
Warning
Breaking Changes
The Django MongoDB Backend v5.2.0 beta 3 release introduces the following breaking change:
Removes support for pattern matching lookups on non-string fields. Previously, these lookups cast their input by using the
$toStringoperator. This caused performance issues because MongoDB could not use indexes when running the query.
Version 5.2.0 beta 2
Warning
Breaking Changes
This version release introduces the following breaking changes:
Limits
django.db.models.SmallIntegerFieldanddjango.db.models.PositiveSmallIntegerFieldvalues to 32 bits in forms and model validation.Removes support for database caching. This prevents an attacker who has compromised the database from using pickle-encoded cache values to run arbitrary commands on the application server.
The Django MongoDB Backend v5.2.0 beta 2 release includes the following features, improvements, and fixes:
Adds support for MongoDB Search queries. To learn more, see the Run a MongoDB Search Query guide.
Adds subquery support for
EmbeddedModelArrayFieldvalues. To learn more, see Query Embedded Model Array Values in the Specify a Query guide.Adds the
optionsparameter to thedjango_mongodb_backend.utils.parse_uri()method.Adds support for database transactions. To learn more, see the Transactions and Sessions guide.
Adds
PolymorphicEmbeddedModelFieldandPolymorphicEmbeddedModelArrayFieldfields, which store a model instance or list of model instances that can belong to more than one model class. To learn more, see Store Polymorphic Embedded Model Data in the Create Models guide.Adds GeoDjango support. To learn more, see the Model Geospatial Data guide.
Updates
QuerySet.explain()to return a string that can be parsed as JSON.Fixes unique constraint generation for the
IntegerFieldandPositiveBigIntegerFieldfields, which incorrectly allowed duplicate values larger than 32 bits. You must recreate existing unique constraints to use$type: longinstead ofint.Sends the following fields to MongoDB as
bson.int64.Int64values, which fixes unique constraints on values less than 32 bits:IntegerFieldBigIntegerFieldPositiveIntegerFieldPositiveBigIntegerFieldDurationField
Improves
QuerySetperformance by removing the low limit on server-side chunking.Improves the performance of join operations, which use the
$lookupaggregation stage, by pushing some simple conditions from the$matchstage to the$lookupstage.
Version 5.2.0 beta 1
The Django MongoDB Backend v5.2.0 beta 1 release includes the following features, improvements, and fixes:
Adds the
EmbeddedModelArrayFieldfield for storing a list of model instances. To learn more, see Store Embedded Model Array Data in the Create Models guide.Fixes a crash that occurred when loading models that have a null
ArrayFieldvalue and abase_fieldusing a database converter.
Version 5.2.0 beta 0
Warning
Breaking Changes
This version release introduces the following breaking changes:
Increases the minimum supported PyMongo version from 4.6 to 4.7.
Removes the
conn_max_ageparameter ofdjango_mongodb_backend.utils.parse_uri(). Django MongoDB Backend now uses persistent connections by default.
The Django MongoDB Backend v5.2.0 beta 0 release includes the following features, improvements, and fixes:
Adds
SearchIndexandVectorSearchIndexclasses, which allow you to create MongoDB Search and Vector Search indexes. To learn more, see Search Indexes and Vector Search Indexes in the Create Indexes guide.Uses PyMongo's connection pooling by default.
Adds support for a field’s custom lookups and transforms in an
EmbeddedModelField.Fixes the results of queries that use the
tzinfoparameter of theTruncdatabase functions.Adds support for the
QuerySet.dates()andQuerySet.datetimes()methods.Fixes loading of
QuerySetresults for embedded model fields that use database converters.
What's New in 5.1
This section lists the changes introduced in the following patch releases:
Version 5.1.0 beta 4
Warning
Breaking Changes
This version release introduces the following breaking change:
Removes support for database caching. This prevents an attacker who has compromised the database from using pickle-encoded cache values to run arbitrary commands on the application server.
The Django MongoDB Backend v5.1.0 beta 4 release includes the following features, improvements, and fixes:
Fixes a crash that occurred when loading models that have a null
ArrayFieldvalue, and where thebase_fielduses a database converter.Improves
QuerySetperformance by removing the low limit on server-side chunking.
Version 5.1.0 beta 3
The Django MongoDB Backend v5.1.0 beta 3 release includes the following features, improvements, and fixes:
Adds support for a field’s custom lookups and transforms in an
EmbeddedModelFieldFixes the results of queries that use the
tzinfoparameter of theTruncdatabase functionsAdds support for the
QuerySet.dates()andQuerySet.datetimes()methodsFixes loading of
QuerySetresults for embedded model fields that use database converters
Version 5.1.0 beta 2
Warning
Breaking Changes
This version release introduces the following breaking change:
Renames the
sizeparameter for anArrayFieldtomax_size. Thesizeparameter is now used to enforce fixed-length arrays.
The Django MongoDB Backend v5.1.0 beta 2 release includes the following features, improvements, and fixes:
Adds support for database caching. This support is later removed in v5.1.4.
Fixes
QuerySet.raw_aggregate()field initialization when the document key order does not match the order of the model’s fields.
Version 5.1.0 beta 1
Warning
Breaking Changes
This version release introduces the following breaking change:
ObjectIdAutoFieldno longer accepts integer values
The Django MongoDB Backend v5.1.0 beta 1 release includes the following features, improvements, and fixes:
Adds support for saving nested embedded model forms
Fixes persistent database connections
Adds support for asynchronous operations
Adds the
db_nameparameter to thedjango_mongodb_backend.utils.parse_uri()methodAdds a
django_mongodb_backend.routers.MongoRouterrouter, which ensures that Django MongoDB Backend does not create collections for embedded models and that thedumpdatacommand does not include embedded models
Version 5.1.0 beta 0
Django MongoDB Backend v5.1.0 beta 0 is the initial public preview release. To learn more about the public preview features, see the Official Django MongoDB Backend Now Available in Public Preview blog post.