Thursday, 4 May 2017

Sequelize - find item in column of array

I have a column/field in a table which is basically a comma separated items. I am trying to search if one of the item is there in the many list of comma separated items. I am doing this with sequelize and it is throwing up on me. I am using this syntax and it say its wrong:

findOne({
            where: {
                new_hooks: {
                    $contains: [myvaiablehere]
                }
            }
        })

new_hooks is the field which is an array stored as a comma separated items list. A text search inside this field is also fine since these items are unique



via Gary

No comments:

Post a Comment