============================ Known issues and limitations ============================ This document summarizes some known issues and limitations of this library. If you notice an issue not listed, use the :ref:`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 ============ - :class:`~django.db.models.DateTimeField` is limited to millisecond precision (rather than microsecond like most other databases), and correspondingly, :class:`~django.db.models.DurationField` stores milliseconds rather than microseconds. - Some of Django's built-in fields aren't supported by MongoDB: - :class:`~django.db.models.AutoField` (including :class:`~django.db.models.BigAutoField` and :class:`~django.db.models.SmallAutoField`) - :class:`~django.db.models.CompositePrimaryKey` - :class:`~django.db.models.GeneratedField` .. _known-issues-querying: Querying ======== - The following ``QuerySet`` methods aren't supported: - :meth:`~django.db.models.query.QuerySet.extra` - :meth:`~django.db.models.query.QuerySet.prefetch_related` - :meth:`~django.db.models.query.QuerySet.raw` (use :meth:`~django_mongodb_backend.queryset.MongoQuerySet.raw_aggregate` instead) - :meth:`~django.db.models.query.QuerySet.select_for_update` (acts as a no-op) .. versionadded:: 6.0.2 Support for :meth:`~django.db.models.query.QuerySet.difference` and :meth:`~django.db.models.query.QuerySet.intersection` was added. - :meth:`QuerySet.delete() ` and :meth:`~django.db.models.query.QuerySet.update` do not support queries that span multiple collections. - The :class:`~django.db.models.StringAgg` aggregation function isn't supported. - When querying :class:`~django.db.models.JSONField`: - There is no way to distinguish between a JSON ``"null"`` (represented by ``Value(None, JSONField())``) and a SQL ``null`` (queried using the :lookup:`isnull` lookup). Both of these queries return both of these nulls. - Using JSON keys in ``QuerySet.exclude()`` incorrectly treats objects with absent keys as satisfying the exclusion. Database functions ================== - Some of Django's built-in database functions aren't supported by MongoDB: - :class:`~django.db.models.functions.Chr` - :class:`~django.db.models.functions.Ord` - :class:`~django.db.models.functions.SHA1`, :class:`~django.db.models.functions.SHA224`, :class:`~django.db.models.functions.SHA384`, :class:`~django.db.models.functions.SHA512` 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 :doc:`transaction management APIs ` are not supported. Instead, this package provides its own :doc:`transaction APIs `. Database introspection ====================== Due to the lack of ability to introspect MongoDB collection schema, :djadmin:`inspectdb` and :option:`migrate --fake-initial` aren't supported. Caching ======= :ref:`Database caching ` is not supported.