JSONB tree contained in another JSONB tree Query possible?

Hello everyone,

I would like to query based on a contains operation with nested JSONB object. Example:
{a: {b: c}, c: d} contains {a: b, c: d}
This query should evaluate to true because b in the left tree contains the b in the right tree despite the fact that the the left b has another child c. Would this work with normal contains operation?

I found one example on the internet which shows that the following should work:

{sizes: [M, L, XL]} contains {sizes: [M, L,]}

According to this, the contains operation is applied recursively to the child fields, do you think also my example above would work?

Thank you for your help!

This really isn’t a Django question. You might get a more direct and clear answer by asking this in a more PostgreSQL-focused forum. (Once you’ve determined what the PostgreSQL specific answer is, then we can help with a Django-based implementation.)