Opened 2 years ago

Last modified 2 years ago

#27694 new Cleanup/optimization

Improve documentation of supported lookups on HStore & JSON fields

Reported by: Stephen Burrows Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The documentation of supported lookups on HStore & JSON fields is lacking. For example, HStoreField supports iexact lookups, but the documentation has a scary warning implying that this is not the case:

Since any string could be a key in a hstore value, any lookup other than those listed below will be interpreted as a key lookup.

iexact is not listed below – but neither is contains, which is used directly above the scary warning as an example of how "You can chain other lookups after key lookups". (Actually, contains is listed below, but it's a different contains that applies only to the field level and not to a specific key.)

I suspect that the intended meaning is that all lookups are supported after a key lookup, and that the first lookup on the hstore field must be a key or one of the special lookups listed below.

JSONField does not mention being able to chain lookups after key lookups at all - but I can see people using gt and in in blog posts like this. BUT iexact lookups don't currently work on JSONField.

Change History (1)

comment:1 Changed 2 years ago by Tim Graham

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization
Note: See TracTickets for help on using tickets.
Back to Top