Limitations and Upcoming Features
On this page
- Overview
- Feature Limitations
- Unsupported Database Variables
- Model Limitations
- Querying Limitations
- Django Management Command Limitations
- Migration Limitations
- Asynchronous Limitations
- Data Types
- Performance
- General Availability Release Features
- MongoDB Features
- Model Features
- Django Management Command Features
- Third Party Features
- Database Variable Support
- Asynchronous Support
Overview
On this page, you can find a list of features that Django MongoDB Backend does not support. You can also find features currently planned for the General Availability (GA) and post-GA releases. We will prioritize these upcoming features based on user demand, and you can request support for a feature by leaving a suggestion on the Drivers Feedback Forum.
Feature Limitations
In this section, you can learn about the following types of unsupported Django and MongoDB features:
Unsupported Database Variables
The following database variables are not supported by Django MongoDB Backend:
ATOMIC_REQUESTS
AUTOCOMMIT
CONN_HEALTH_CHECKS
TIME_ZONE
Model Limitations
The following limitations apply to models in Django MongoDB Backend:
Django MongoDB Backend enforces a one-to-one mapping between a Django model and a MongoDB collection. Because of this, multiple models cannot share the same collection.
Indexes
Django MongoDB Backend does not support the following index functionalities:
Creating
$vectorSearch
and$search
indexes through the Django Indexes APICreating geospatial indexes through the Django Indexes API
Updating indexes in
EmbeddedModelFields
after model creation
To learn how to run unsupported database operations by operating directly on
your MongoClient
instance, see MongoClient Operations in the
Perform Raw Database Queries guide.
Fields
Django MongoDB Backend has the following limitations on the specified field types:
ArrayField
Django MongoDB Backend does not support
ArrayField
polymorphism.Django MongoDB Backend does not support nesting an
EmbeddedModelField
within anArrayField
.
EmbeddedModelField
EmbeddedModel
schema changes do not register after creation.Embedded documents cannot take Django foreign keys.
Django MongoDB Backend does not support arbitrary or untyped embedded model fields. You must derive all fields from a
EmbeddedModel
class.
JSONField
Django MongoDB Backend cannot distinguish between a JSON and a SQL
null
value. Queries that useValue(None, JSONField())
or theisnull
lookup return both JSON and SQLnull
values.Some queries with
Q
objects, such asQ(value__foo="bar")
, might not work as expected.Filtering for
None
values incorrectly returns objects in which a field does not exist.
DateTimeField
Django MongoDB Backend does not support microsecond granularity for
DateTimeField
.
DurationField
DurationField
stores milliseconds rather than microseconds.
ForeignKey
When possible, you should use an
EmbeddedModelField
instead of aForeignKey
field to avoid using$lookup
operations. AnEmbeddedModelField
emulates a MongoDB embedded document and performs better than aForeignKey
field. To learn more about how to reduce$lookup
operations, see the Reduce $lookup Operations guide in the Atlas documentation.Performance of CASCADE deletes on a
ForeignKey
field is not as performant as using anEmbeddedModelField
.
The following field types are unavailable in Django MongoDB Backend:
GeneratedField
AutoField
BigAutoField
SmallAutoField
Querying Limitations
Django MongoDB Backend does not support the following QuerySet
API methods:
distinct()
dates()
datetimes()
prefetch_related()
extra()
Django MongoDB Backend does not support QuerySet.delete()
and update()
queries
that span multiple collections.
Geospatial Queries
Django MongoDB Backend does not support
GeoDjango
.Django MongoDB Backend does not have any Django lookup operators for MongoDB-specific geospatial queries.
Aggregation Operators
Django MongoDB Backend does not contain any custom Django field lookups for the MongoDB
aggregation framework. Instead, use the raw_aggregate()
method. For more
information on the raw_aggregate()
method, see
the Perform Raw Database Queries guide.
Database Functions
Django MongoDB Backend does not support the following database functions:
Chr
ExtractQuarter
MD5
Now
Ord
Pad
Repeat
Reverse
Right
SHA1
,SHA224
,SHA256
,SHA384
,SHA512
Sign
The tzinfo
parameter of the Trunc
database functions doesn't work
properly because MongoDB converts the result back to UTC.
Django Management Command Limitations
Django MongoDB Backend does not support the following Django management commands:
createcachetable
inspectdb
optimizemigration
sqlflush
sqlsequencereset
Migration Limitations
Django MongoDB Backend does not support enforced schema validation. To learn how to enforce schema validation in your application, see the Specify JSON Schema Validation guide in the MongoDB Server manual.
Django MongoDB Backend does not support DDL Transactions.
Django MongoDB Backend does not support the
migrate --fake-initial
command.
Asynchronous Limitations
Django MongoDB Backend has not been tested for support of the asynchronous functionality of the Django API.
Data Types
Django MongoDB Backend does not have a custom Field
class for the BSONRegExp
data type. Instead, use the CharField
class.
Performance
The engineering team is prioritizing feature development for the Public Preview release of Django MongoDB Backend. Because of this, you might notice performance limitations with certain workloads. If you encounter any performance issues, please report them as shown in the Issues & Help guide. You can also share your feedback on the Drivers Feedback Forum.
General Availability Release Features
In this section, you can learn about the following types of Django and MongoDB features that GA and post-GA Django MongoDB Backend releases will likely introduce:
MongoDB Features
We plan to support the following MongoDB features in the GA release:
Programmatic management of Vector Search, Atlas Search, and geospatial indexes by using the Django API
Vector Search, Atlas Search, and geospatial queries by using the Django API
Queryable Encryption and Client-side Field Level Encryption
Database transactions
Storage of cached data in the database
We plan to support the following MongoDB features in future post-GA releases:
GridFS for large file storage
Change streams for data monitoring
Schema validation
Tip
To learn more about the MongoDB features mentioned in this section, see the following resources:
Atlas Vector Search in the Atlas documentation
Atlas Search in the Atlas documentation
Geospatial Queries in the MongoDB Server manual
In-Use Encryption in the MongoDB Server manual
Transactions in the MongoDB Server manual
GridFS in the MongoDB Server manual
Change Streams in the MongoDB Server manual
Model Features
We plan to support the following model features in the GA release:
Arrays of embedded documents
Polymorphic embedded documents and arrays
Application of changes to the embedded model schema to
EmbeddedModelField
valuesMultiple models within a collection
Improved form representation in embedded models
In future post-GA releases, we plan to support a custom Field
class for the BSONRegExp
data type.
Django Management Command Features
We plan to support the following Django commands in the GA release:
dumpdata
loaddata
Third Party Features
We plan to support the following third-party features in the GA release:
Database Variable Support
We plan to support the following Django variables for configuring your database connection in future post-GA releases:
CONN_HEALTH_CHECKS
TIME_ZONE
Asynchronous Support
We plan to offer asynchronous support for Django MongoDB Backend in future post-GA releases.