I am not sure to understand how far we could use the JSONB type of PostgreSQL 9.4
For example, if I store the following in a JSON field:
id | data
----+--------------------------------------
1 | {"a": ["1", "2"]}
2 | {"b": ["1", "5"]}
3 | {"a": ["1", "3", "8"], "c": ["1", "2"]}
4 | {"a": ["7", "8"]}
How can I select the rows where the JSONB field has a key "a" that has the value "1" in its list?
For this example, the result would be:
id | data
----+--------------------------------------
1 | {"a": ["1", "2"]}
3 | {"a": ["1", "3", "8"], "c": ["1", "2"]}
(2 rows)
If yes, how to use it with django?
Thanks