#37349: Add note about object key order in JSONField docs
--------------------------------------+------------------------------------
Reporter: Lincoln | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):
* stage: Unreviewed => Accepted
Comment:
I think adding a link to the Postgres docs considering we already have a
section on the `jsonb` vs `json` types makes sense. I am also ok with a
small note about the key order.
I agree with David that we try not to document other systems, but as we
already have a section on this, I am comfortable with making that section
slightly more informative.
My suggestion would be:
{{{#!diff
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1508,8 +1508,12 @@ To query ``JSONField`` in the database, see :ref
:`querying-jsonfield`.
queried. PostgreSQL's ``json`` field is stored as the original string
representation of the JSON and must be decoded on the fly when
queried
based on keys. The ``jsonb`` field is stored based on the actual
structure
- of the JSON which allows indexing. The trade-off is a small
additional cost
- on writing to the ``jsonb`` field. ``JSONField`` uses ``jsonb``.
+ of the JSON, which allows indexing but doesn't preserve the order of
object
+ keys. The trade-off is a small additional cost on writing to the
``jsonb``
+ field. ``JSONField`` uses ``jsonb``.
+
+ For more details, see PostgreSQL's `documentation on JSON types
+ <
https://www.postgresql.org/docs/current/datatype-json.html>`_.
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/37349#comment:2>