Skip to content

DOCSP-46329 Add Limitations page #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Django MongoDB Backend

.. toctree::

Limitations </limitations>
Issues & Help </issues-and-help>
Compatibility </compatibility>

Expand Down
207 changes: 207 additions & 0 deletions source/limitations.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
.. _django-limitations:

============
Limitations
============

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jordan-smith721 we should probably add a link here that if you a user wants us to support any specific feature listed here. They should let us know through our feedback portal: https://feedback.mongodb.com/forums/924286-drivers?category_id=370732 They can also vote on existing requested feature if it is relevant to them.

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: support, features, django

Overview
--------

On this page, you can find a list of features that
{+django-odm+} does not support. Because {+django-odm+} is in active
development, some features listed on this page might be considered for future
releases based on user demand. You can request support for a feature by leaving
a suggestion on the `Drivers Feedback Forum
<https://feedback.mongodb.com/forums/924286-drivers?category_id=370732>`__.

Unsupported Database Variables
------------------------------

The following database variables are not supported by {+django-odm+}:

- ``ATOMIC_REQUESTS``
- ``AUTOCOMMIT``
- ``CONN_HEALTH_CHECKS``
- ``TIME_ZONE``

Model Limitations
-----------------

The following limitations apply to models in {+django-odm+}:

- {+django-odm+} 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
~~~~~~~

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: should we also mention that expression indexes aren't supported? @Jibola

{+django-odm+} does not support the following index functionalities:

- Creation of ``$vectorSearch`` and ``$search`` indexes through the Django
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: to match the verb tense of the other list items:

Suggested change
- Creation of ``$vectorSearch`` and ``$search`` indexes through the Django
- Creating ``$vectorSearch`` and ``$search`` indexes through the Django

Indexes API
- Creating geospatial indexes through the Django Indexes API
- Updating indexes in ``EmbeddedModelFields`` after model creation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link to the page where we cover exposing mongoclient so that people know the workaround? @Jibola

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's in the "Raw Queries" section


To learn how to run unsupported database operations by operating directly on
your ``MongoClient`` instance, see the :ref:`django-client-operations` guide.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This link will work once the PR is merged in

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: since this is a section in the Raw Queries guide

Suggested change
your ``MongoClient`` instance, see the :ref:`django-client-operations` guide.
your ``MongoClient`` instance, see :ref:`django-client-operations` in the Perform Raw Database Queries guide.


Fields
~~~~~~

{+django-odm+} has the following limitations on the specified field types:

- ``ArrayField``

- {+django-odm+} does not support ``ArrayField`` polymorphism.
- {+django-odm+} does not support ``EmbeddedModelField`` within an ``ArrayField``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: a little clearer

Suggested change
- {+django-odm+} does not support ``EmbeddedModelField`` within an ``ArrayField``.
- {+django-odm+} does not support nesting an ``EmbeddedModelField`` within an ``ArrayField``.


- ``EmbeddedModelField``

- ``EmbeddedModel`` schema changes do not register after creation.
- Embedded documents cannot take Django foreign keys.
- {+django-odm+} does not support arbitrary or untyped embedded model
fields. You must derive all fields from a ``EmbeddedModel`` class.

- ``JSONField``

- {+django-odm+} 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 with a ``None`` key incorrectly returns objects in which a key
does not exist.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: I think using field/value mongodb terminology makes more sense, since you use "value" in the first bullet

Suggested change
- Filtering with a ``None`` key incorrectly returns objects in which a key
does not exist.
- Filtering for ``None`` values incorrectly returns objects in which a field
does not exist.


- ``DateTimeField``

- {+django-odm+} does not support microsecond granularity for
``DateTimeField``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I: indentation error here; maybe this fixes it?

Suggested change
- {+django-odm+} does not support microsecond granularity for
``DateTimeField``.
- {+django-odm+} does not support microsecond granularity for
``DateTimeField``.


- ``DurationField``

- The ``DurationField`` stores milliseconds rather than microseconds.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: to avoid starting list items with articles:

Suggested change
- The ``DurationField`` stores milliseconds rather than microseconds.
- ``DurationField`` stores milliseconds rather than microseconds.


- ``ForeignKey``

- 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: remove comma before dependent clause

Suggested change
``EmbeddedModelField`` emulates a MongoDB embedded document, and performs
``EmbeddedModelField`` emulates a MongoDB embedded document and performs

better than a ``ForeignKey`` field. To learn more about how to reduce
``$lookup`` operations, see the :atlas:`Reduce $lookup Operations
</schema-suggestions/reduce-lookup-operations/>` guide in the Atlas
documentation.
- The performance of `CASCADE deletes <{+django-docs+}/ref/models/fields/#foreignkey>`__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: might be better to link to the specific cascade section; also article

Suggested change
- The performance of `CASCADE deletes <{+django-docs+}/ref/models/fields/#foreignkey>`__
- Performance of `CASCADE deletes <{+django-docs+}/ref/models/fields/#django.db.models.CASCADE>`__

on a ``ForeignKey`` field is not as performant as using an
``EmbeddedModelField``.

The following field types are unavailable in {+django-odm+}:

- ``GeneratedField``
- ``ImageField``
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``ImageField``
- ``AutoField``
- ``BigAutoField``
- ``SmallAutoField``

Looks like we support ImageField. I'll place

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add to the fields in the Create Models guide


Querying Limitations
--------------------

{+django-odm+} does not support the following ``QuerySet`` API methods:

- ``distinct()``
- ``dates()``
- ``datetimes()``
- ``prefetch_related()``
- ``extra()``

{+django-odm+} does not support ``QuerySet.delete()`` and ``update()`` queries
that span multiple collections.

Geospatial Queries
~~~~~~~~~~~~~~~~~~

- {+django-odm+} does not support ``GeoDjango``.
- {+django-odm+} does not have any Django lookup operators for MongoDB-specific
geospatial queries.

Aggregation operators
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S:

Suggested change
Aggregation operators
Aggregation Operators

~~~~~~~~~~~~~~~~~~~~~

{+django-odm+} does not contain any custom Django Field lookups for the MongoDB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: lowercase field (I think)

Suggested change
{+django-odm+} does not contain any custom Django Field lookups for the MongoDB
{+django-odm+} 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: you can link to the raw query guide; also, I'd add () after method names

Suggested change
aggregation framework. Instead, use the ``raw_aggregate`` method. For more
information on the ``raw_aggregate`` method.
aggregation framework. Instead, use the ``raw_aggregate()`` method. For more
information on the ``raw_aggregate()`` method, see
the :ref:`django-raw-queries` guide.


.. TODO: Link to aggregation

Database Functions
~~~~~~~~~~~~~~~~~~

{+django-odm+} 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-odm+} does not support the following Django management commands:

- ``createcachetable``
- ``inspectdb``
- ``optimizemigration``
- ``sqlflush``
- ``sqlsequencereset``

Migration Limitations
---------------------

- {+django-odm+} does not support enforced schema validation. To learn how to
enforce schema validation in your application, see the :manual:`Specify JSON
Schema Validation </core/schema-validation/specify-json-schema/>` guide in the
{+mdb-server+} manual.
- {+django-odm+} does not support `DDL Transactions
<{+django-docs+}/topics/migrations/#transactions>`__.
- {+django-odm+} does not support the ``migrate --fake-initial`` command.

Asynchronous Support
--------------------

{+django-odm+} has not been tested for support of the asynchronous functionality of
the Django API.

Data Types
----------

{+django-odm+} 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-odm+}. Because of this, you might notice performance
limitations with certain workloads. If you encounter any performance issues,
please report it as shown in the :ref:`Issues & Help <django-issues-and-help>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: [nit]

Suggested change
please report it as shown in the :ref:`Issues & Help <django-issues-and-help>`
please report them as shown in the :ref:`Issues & Help <django-issues-and-help>`

guide. You can also share your feedback on the `Drivers Feedback Forum
<https://feedback.mongodb.com/forums/924286-drivers?category_id=370732>`__.
Loading