#29157: Getting Distinct Values from List in a JSONField
---------------------------------------------+------------------------
               Reporter:  Hrishikesh Barman  |          Owner:  (none)
                   Type:  New feature        |         Status:  new
              Component:  contrib.postgres   |        Version:  2.0
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 We can access JSONField Data
 
(https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#django.contrib.postgres.fields.JSONField)
 like this `Dog.objects.filter(data__owner__name='Bob')`

 But for JSONField consisting of a list this does not work.

 {{{
 [{'a':12,'b':33},{'a':44,'b':99}]
 }}}

 Filtering values like this works:

 {{{
 Frame.objects.filter(
 size__contains=[{'a': 12,'b': 33}]
 )
 }}}

 But there is no way to get distinct values from a list in a JSONfield, for
 eg. the following does not work.
 {{{
 Frame.objects.values( 'size__a')
 }}}

 Should there be an implementation of the same?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29157>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.637bb0bc52a4d7e6d29fa3645036beb4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to