I am trying to grab a list of values from a one-to-many relationship. Once I have those values I planned to delete them.

I have tried using Op.in method on a where key.

let queryValues = await productInput.findAll({
        include: [{
            model: productInputValue,
            where: {
                id: Sequelize.col('productInputValue.inputId')
            }
        }]
    });

    console.log('Query values', JSON.stringify(queryValues, null, '\t'));

I am expecting to receive a list of values associated with a specific product. Once I have those values I want to delete them.

This is error I keep getting

An expression of non-boolean type specified in a context where a condition is expected, near ';'

I have a one-to-many relationship between ProductInput and ProductInputValue. I am trying to dynamically query the values tied to a specific product. Once I have acquired those values, I want to delete them.

What am I doing in my query? How should the query look to grab and delete those values?

0 Answers