Querying nested arrays in Postgres JSON field with Rails -


i using postgres 9.3 json data type. want query data nested within array.

for example, want query users have of interests = ["music", "movies", "programming"].

thanks!

example:

model user    data: {     "name": "johndoe1",     "github": "johndoe1",     "bio": "lorem ipsum dolor sit amet, consectetur adipisicing elit. labore impedit aliquam sapiente dolore magni aliquid ipsa ad, enim, esse ut reprehenderit quaerat deleniti fugit eaque. vero eligendi voluptatibus atque, asperiores.",     "blog": "http://johndoe1.example.com",     "interests": [       "music",       "movies",       "programming"     ],     "age": 35,     "newsletter": true   } 

user.where("data -> 'interests' = '[\"music\", \"movies\", \"programming\"]'") not working.


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -