Docs Menu
Docs Home
/ / /
Django MongoDB Backend

Django and MongoDB Feature Compatibility

On this page

  • Overview
  • MongoDB Features
  • Index Support
  • Data Type Support
  • Query Support
  • Database and Collection Support
  • Django Features
  • Field Type Support
  • Query Support
  • Database Function Support
  • Management Support
  • Migration Support
  • Third Party Library Support

On this page, you can find information about supported and unsupported features in Django MongoDB Backend. 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 creating a JIRA issue.

This section indicates whether the Django MongoDB Backend supports various MongoDB features and which features we plan to support in the GA release.

Important

Unsupported MongoDB features that have a checkmark () symbol in the General Availability Support column are planned for the GA release. However, support is not guaranteed.

MongoDB Feature
Current Support
General Availability Support

Atlas Search and Atlas Vector Search indexes

Unsupported. You cannot use the Django Indexes API to create these indexes, but you can use the PyMongo Driver by exposing your MongoClient.

Compound indexes

Embedded document indexes

Geospatial indexes

Unsupported. You cannot use the Django Indexes API to create these indexes, but you can use the PyMongo Driver by exposing your MongoClient.

Multikey indexes

Partial indexes

Single field indexes

Unique indexes

Updating EmbeddedModelFields indexes after model creation

Unsupported.

Django MongoDB Backend currently supports all MongoDB data types not included in the following table. To view a full list of supported types, see the MongoDB BSON Fields section of the Create Models guide.

BSON Data Type
Current Support
General Availability Support

Array

Partially Supported. You can use the ArrayField field type with the following limitations:

  • ArrayField polymorphism is not supported.

  • Nested EmbeddedModelField values within an ArrayField are not supported.

Object

Partially Supported. You can use the EmbeddedModelField field type with the following limitations:

  • EmbeddedModel schema changes do not register after creation.

  • Embedded documents cannot take Django foreign keys.

  • Arbitrary or untyped embedded model fields are not supported. You must derive all fields from a EmbeddedModel class.

Partial Support Planned. We plan to add support for registering EmbeddedModel schema changes after creation.

Regular Expression

Unsupported.

Unsupported. However, we plan to support this type in a post-GA release.

MongoDB Feature
Current Support
General Availability Support

Aggregation operations

Partially Supported. The Django MongoDB Backend does not include custom Django field lookups for the MongoDB aggregation framework, but you can use the raw_aggregate() method.

Full Support Not Planned. However, we plan to add support for MongoDB aggregation operators in a post-GA release.

Atlas Search queries

Partially Supported. You cannot use the Django QuerySet API to run Atlas Search queries, but you can use the raw_aggregate() method.

Delete operations

Geospatial queries

Partially Supported. You cannot use the Django QuerySet or GeoDjango API to run geospatial queries, but you can use the raw_aggregate() method.

Insert operations

Read operations

Update operations

Vector Search queries

Partially Supported. You cannot use the Django QuerySet API to run Vector Search queries, but you can use the raw_aggregate() method.

MongoDB Feature
Current Support
General Availability Support

Asynchronous support

Authentication

Cached data storage

Unsupported.

Change Streams

Unsupported.

Unsupported. However, we plan to add support for this feature in a post-GA release.

Client-side Field Level Encryption and Queryable Encryption

Unsupported.

Collection interaction

Database interaction

GridFS

Unsupported.

Unsupported. However, we plan to add support for this feature in a post-GA release.

Multiple models for one collection

Unsupported.

Representing documents

✓ Use models to represent MongoDB documents.

Schema validation

Unsupported.

Unsupported. However, we plan to add support for this feature in a post-GA release.

Timeseries data

Transactions

Unsupported.

This section indicates whether the Django MongoDB Backend supports various Django features and which features we plan to support in the GA release.

Important

Unsupported Django features that have a checkmark () symbol in the General Availability Support column are planned for the GA release. However, support is not guaranteed.

Django MongoDB Backend currently supports all Django field types not included in the following table. To view a full list of supported fields, see the Django Fields section of the Create Models guide.

Django Field Type
Current Support
General Availability Support

AutoField

Unsupported. The BigAutoField and SmallAutoField types are also not supported. Instead, use ObjectIdField.

Unsupported.

DateTimeField

Partially Supported. You can use this field type with the following limitations:

  • Microsecond granularity for DateTimeField values is not supported.

Full Support Not Planned.

DurationField

Partially Supported. You can use this field type with the following limitations:

  • DurationField stores milliseconds rather than microseconds

Full Support Not Planned.

ForeignKey

Partially Supported. You can use this field type with the following limitations:

  • When possible, you should use an EmbeddedModelField instead of a ForeignKey field to avoid using $lookup operations. An EmbeddedModelField emulates a MongoDB embedded document and performs better than a ForeignKey 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 an EmbeddedModelField.

Full Support Not Planned.

GeneratedField

Unsupported.

Unsupported.

JSONField

Partially Supported. You can use this field type with the following limitations:

  • Django MongoDB Backend cannot distinguish between a JSON and a SQL null value. Queries that use Value(None, JSONField()) or the isnull lookup return both JSON and SQL null values.

  • Some queries with Q objects, such as Q(value__foo="bar"), might not work as expected.

  • Filtering for None values incorrectly returns objects in which a field does not exist.

Full Support Not Planned. However, we plan to address the Q object and None key filtering limitations in a post-GA release.

Django MongoDB Backend currently supports all Django QuerySet methods not included in the following table. To view the supported methods, see QuerySet API in the Django documentation.

Django QuerySet Feature
Current Support
General Availability Support

bulk_update()

Unsupported.

Unsupported.

dates()

Unsupported.

Unsupported.

datetimes()

Unsupported.

Unsupported.

delete()

Partially Supported. You cannot use this method to perform queries that span multiple collections.

Full Support Not Planned.

extra()

Unsupported.

Unsupported.

JOIN operations

Partially Supported. You can use MongoDB's $lookup pipeline stage to perform joins.

Full Support Not Planned.

prefetch_related()

Unsupported.

Unsupported.

raw()

Unsupported. However, you can use the raw_aggregate() method to run queries that use MongoDB's aggregation pipeline syntax.

Full Support Not Planned.

update()

Partially Supported. You cannot use this method to perform queries that span multiple collections.

Full Support Not Planned.

Django MongoDB Backend currently supports all database functions not included in the following table. To view a full list of functions, see Database Functions in the Django documentation.

Django Function
Current Support
General Availability Support

Chr

Unsupported.

Unsupported.

ExtractQuarter

Unsupported.

Unsupported.

MD5

Unsupported.

Unsupported.

Now

Unsupported.

Unsupported.

Ord

Unsupported.

Unsupported.

Pad

Unsupported.

Unsupported.

Repeat

Unsupported.

Unsupported.

Reverse

Unsupported.

Unsupported.

Right

Unsupported.

Unsupported.

SHA1, SHA224, SHA256, SHA384, SHA512

Unsupported.

Unsupported.

Sign

Unsupported.

Unsupported.

Trunc

Partially Supported. The tzinfo parameter doesn't work properly because MongoDB converts the result back to UTC.

Full Support Not Planned.

Django Feature
Current Support
General Availability Support

Django Admin

Django Forms

Django Authentication

Management commands

Partially Supported. To view the unsupported commands, see the following section.

Full Support Not Planned.

Django MongoDB Backend currently supports all management commands not included in the following table. To view a full list of commands, see Available commands in the Django documentation.

Django Command
Current Support
General Availability Support

createcachetable

Unsupported.

Unsupported.

dumpdata

Unsupported.

inspectdb

Unsupported.

Unsupported. However, we plan to support this command in a post-GA release.

loaddata

Unsupported.

sqlflush

Unsupported.

Unsupported.

sqlsequencereset

Unsupported.

Unsupported.

Django Feature
Current Support
General Availability Support

Creating, deleting, and updating indexes through migration commands

Partially Supported. You cannot update indexes on embedded model or array fields.

Full Support Not Planned.

Unsupported.

Unsupported.

migrate --fake-initial option

Unsupported.

Unsupported.

Library
Current Support
General Availability Support

Partially Supported. Most use cases are supported.

Partially Supported. This release will outline use case limitations.

Partially Supported. Most use cases are supported.

Partially Supported. This release will outline use case limitations.

Partially Supported. Most use cases are supported.

Partially Supported. This release will outline use case limitations.

Unsupported.

Partially Supported. This release will outline use case limitations.

Partially Supported. Most use cases are supported.

Partially Supported. This release will outline use case limitations.

Back

Perform Raw Queries