[Django] #36462: Should we include documentation for has_any_keys for the JSONField if the value is an array.

3 views
Skip to first unread message

Django

unread,
Jun 12, 2025, 7:16:11 AM6/12/25
to django-...@googlegroups.com
#36462: Should we include documentation for has_any_keys for the JSONField if the
value is an array.
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Type: New
| feature
Status: new | Component:
| Documentation
Version: 5.1 | Severity: Normal
Keywords: orm, documentation, | Triage Stage:
JSON, postgreSQL. | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Recently, there was a question on
[https://stackoverflow.com/a/79662455/67579 StackOverflow] about how to
query a JSON field that has an array, to look if the array contains at
least one of the items.

A bit surprising, but the `?|` operator does that, indeed
[https://www.postgresql.org/docs/9.5/functions-json.html according to the
docs], this use-case is not (well) documented in Django, and `keys`
evidently suggests that it is for dictionaries.

I'm wondering if we should include such cases in the documentation, so add
an example where the JSON blob is an array of strings for example, and
demonstrate how it is filtered.
--
Ticket URL: <https://code.djangoproject.com/ticket/36462>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages