Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在sequelize中使用多个或多个_Javascript_Node.js_Database_Sequelize.js_Where - Fatal编程技术网

Javascript 在sequelize中使用多个或多个

Javascript 在sequelize中使用多个或多个,javascript,node.js,database,sequelize.js,where,Javascript,Node.js,Database,Sequelize.js,Where,我想在sequelize中使用3或条件编写一个有点复杂的where SQL其中示例: where (c1 = 'a' or c2 = 'b' or c3 = 'c' or c4 = 'd') and (c5 = 'e' or c6 = 'f' or c7 = 'g' or c8 = 'h') and (c9 = 'i' or c10 = 'j') 在Sequalize中,我写了如下内容: where: { $and: { $or: [{ c1: 'a' }, { c2: 'b

我想在sequelize中使用3或条件编写一个有点复杂的
where

SQL
其中
示例:

where 
(c1 = 'a' or c2 = 'b' or c3 = 'c' or c4 = 'd') 
and (c5 = 'e' or c6 = 'f' or c7 = 'g' or c8 = 'h') 
and (c9 = 'i' or c10 = 'j')
在Sequalize中,我写了如下内容:

where: {
  $and: {
    $or: [{ c1: 'a' }, { c2: 'b' }, { c3: 'c' }, { c4: 'd' }]
  },
  $or: [{ c5: 'e' }, { c6: 'f' }, { c7: 'g' }, { c8: 'h' }]
}
但是如何添加这个对象:
$或:[{c9:'I'},{c10:'j'}]


注意:在我使用的项目中,不要担心,
Op

您需要一个带有内部部件条款的外部
$和
属性

where: {
    $and: [
        {
            $or: [
                { c1: 'a' }, { c2: 'b' }, { c3: 'c' }, { c4: 'd' }
            ]
        },
        {
            $or: [
                { c5: 'e' }, { c6: 'f' }, { c7: 'g' }, { c8: 'h' }
            ]
        },
        {
            $or: [
                { c9: 'i' }, { c10: 'j' }
            ]
        }
    ]
}