summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorjpribyl <pribylsnbits@gmail.com>2020-09-04 08:16:46 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-09-04 09:04:38 +0200
commit17407eca59b0572228067cdee51433f49a1e0adb (patch)
tree730b8bd44abaab3720503bb2fd6c77309a2c3cb5 /docs
parent94e22381079d65dccb9ac1ad9a9ebea2af2fdf66 (diff)
Fixed #31894 -- Added note about using JSONField key lookups with QuerySet.exclude() in docs.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/queries.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt
index 1b71cd77ff..637975bb2e 100644
--- a/docs/topics/db/queries.txt
+++ b/docs/topics/db/queries.txt
@@ -910,6 +910,14 @@ To query for missing keys, use the ``isnull`` lookup::
:lookup:`istartswith`, :lookup:`lt`, :lookup:`lte`, :lookup:`gt`, and
:lookup:`gte`, as well as with :ref:`containment-and-key-lookups`.
+.. note::
+
+ Due to the way in which key-path queries work,
+ :meth:`~django.db.models.query.QuerySet.exclude` and
+ :meth:`~django.db.models.query.QuerySet.filter` are not guaranteed to
+ produce exhaustive sets. If you want to include objects that do not have
+ the path, add the ``isnull`` lookup.
+
.. warning::
Since any string could be a key in a JSON object, any lookup other than