The model I'm trying to query has a jsonb[] field data
and looks like this
data = [{"id":"1","name":"abc","place":"def"},{"id":"2","name":"xyz","place":"uvw"}]
I tried querying it using the solution listed here How to filter JSON Array in Django JSONField
The query I'm running:
name = MyModel.objects.filter(
Q(data__contains=[{"name":"abc"}])
)
This query returns an empty query set.
If I change data
to [{"name":"abc"},{"name":"xyz"}]
, then this query works
How do I make this query work with all the keys in the json object?