Hi,
I recently discovered by a person asking this on StackOverflow that the ?|
operator in PostgreSQL, in Django the __has_any_keys
lookup, does not only work with dictionaries, but also with lists, so if data is ['a', 'b']
, we can query with MyModel.objects.filter(data__has_any_keys=['a', 'c'])
.
I have asked on Django tickets if we should include it in the documentation, but it turns out this only works for PostgreSQL, not other databases with JSON support.
I think it is still useful to include it in the documentation, but then as PostgreSQL specific behavior, or perhaps try to introduce a lookup that works cross-database?
Any ideas?