Are you looking for all rows where the jsonb column is null? Or, are you looking for all rows where the jsonb column is an empty object '{}'? Some example code/sql would help here.
I am looking for all the rows where the jsonb column is an empty object '{}' . I actually tried Active Record query interface Model.where.not(my_column: {})
Sign up to request clarification or add additional context in comments.
Comments
0
You can do this by converting the json to string, and count the length. Empty json will return 2. This works for both {} and [].
E.g. To return empty comment
null? Or, are you looking for all rows where the jsonb column is an empty object '{}'? Some example code/sql would help here.