Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 10 additions & 4 deletions docs/ref/models/querysets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ Supported ``QuerySet`` methods
All of Django's :doc:`QuerySet methods <django:ref/models/querysets>` are
supported, except:

- :meth:`extra() <django.db.models.query.QuerySet.extra>`
- :meth:`prefetch_related() <django.db.models.query.QuerySet.prefetch_related>`
- :meth:`~django.db.models.query.QuerySet.difference`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

MongoDB has $setDifference and $setIntersection. Not sure if they could be used to emulate. @WaVEV Did this cross your radar when implementing support for union()?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I remember we talked about that, but only union was a priority at that time. I think the difference could be handled with a $lookup for the inner query (a similar flow to unionWith) followed by a $match.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I created INTPYTHON-823 Add support for QuerySet.intersection() and difference().

- :meth:`~django.db.models.query.QuerySet.extra`
- :meth:`~django.db.models.query.QuerySet.intersection`
- :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)
Copy link
Collaborator Author

@timgraham timgraham Nov 4, 2025

Choose a reason for hiding this comment

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


In addition, :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>`
and :meth:`update() <django.db.models.query.QuerySet.update>` do not support
queries that span multiple collections.
and :meth:`~django.db.models.query.QuerySet.update` do not support queries that
span multiple collections.

.. _queryset-explain:

Expand Down
15 changes: 11 additions & 4 deletions docs/topics/known-issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ Querying

- The following ``QuerySet`` methods aren't supported:

- :meth:`extra() <django.db.models.query.QuerySet.extra>`
- :meth:`prefetch_related() <django.db.models.query.QuerySet.prefetch_related>`
- :meth:`~django.db.models.query.QuerySet.difference`
- :meth:`~django.db.models.query.QuerySet.extra`
- :meth:`~django.db.models.query.QuerySet.intersection`
- :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)

- :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>` and
:meth:`update() <django.db.models.query.QuerySet.update>` do not support queries
that span multiple collections.
:meth:`~django.db.models.query.QuerySet.update` do not support queries that
span multiple collections.

- When querying :class:`~django.db.models.JSONField`:

Expand Down
Loading