Known issues and limitations¶
This document summarizes some known issues and limitations of this library. If you notice an issue not listed, use the Issue tracker to report a bug or request a feature.
Like any database, MongoDB has some particularities. Also keep in mind that because MongoDB is a NoSQL database, it’s impossible to implement SQL-specific functionality.
Model fields¶
DateTimeFieldis limited to millisecond precision (rather than microsecond like most other databases), and correspondingly,DurationFieldstores milliseconds rather than microseconds.Some of Django’s built-in fields aren’t supported by MongoDB:
AutoField(includingBigAutoFieldandSmallAutoField)
Querying¶
The following
QuerySetmethods aren’t supported:QuerySet.delete()andupdate()do not support queries that span multiple collections.When querying
JSONField:There is no way to distinguish between a JSON
"null"(represented byValue(None, JSONField())) and a SQLnull(queried using theisnulllookup). Both of these queries return both of these nulls.Some queries with
Qobjects, e.g.Q(value__foo="bar"), don’t work properly, particularly withQuerySet.exclude().Filtering for a
Nonekey, e.g.QuerySet.filter(value__j=None)incorrectly returns objects where the key doesn’t exist.You can study the skipped tests in
DatabaseFeatures.django_test_skipsfor more details on known issues.
Pattern matching lookups (
iexact,startswith,istartswith,endswith,iendswith,contains,icontains,regex, andiregex) don’t support non-string fields.
Database functions¶
Transaction management¶
By default, query execution uses Django and MongoDB’s default behavior of autocommit mode. Each query is immediately committed to the database.
Django’s transaction management APIs are not supported. Instead, this package provides its own transaction APIs.
Database introspection¶
Due to the lack of ability to introspect MongoDB collection schema,
inspectdb and migrate --fake-initial aren’t supported.
Caching¶
Database caching is not supported since Django’s built-in database cache backend requires SQL. A custom cache backend for MongoDB may be provided in the future.