Sequelize Op.contains throws Unhandled rejection Error: Invalid value

前端 未结 1 627
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-14 16:03

Given the Postgres 10 JSONB data field partner_json:

{
  \"guid\": \"a659883cedf44131a700a6f563f2c484\",
  \"name\": \"Testing\",
  \"referrerId\": 1,
  \"co         


        
1条回答
  •  离开以前
    2021-01-14 16:40

    I encountered the same error when trying to determine how to use OR. It turned out the issue was with how I was calling OR, not with the actual value, even though the error message stated "Invalid value". This worked for me:

    where: {
                [Sequelize.Op.or]: [{book: true}, {hardcover: true}]
            },
    

    I used this page as a reference: Sequelize API Reference

    I believe aliases are now deprecated, so perhaps this will work:

    where: {
        partner_json: {
            communication: {
                email: {
                    [Sequelize.Op.contains]: [{
                        value: partner_email
                    }]
                }
            }
        }
    },
    

    0 讨论(0)
提交回复
热议问题