How can I query WHERE "NOT NULL" AND "NOT EQUAL TO [STRING]" Using Sequelize?

Viewed 927

I need to get data where property "type1", "type2", etc., etc., is "not equal to 'null'" AND "not equal to the string 'no_issue'". I've tried a few different ways with no luck and this is what I currently have that is not working:

  [Op.and]: [
        { type1: { [Op.not]: null }},
        { type1: { [Op.ne]: 'no_issue' }},
        { next_item: 'next' }
     ],
     [Op.and]: [
      { type2: { [Op.not]: null }},
      { type2: { [Op.ne]: 'no_issue' }},
      { next_item: 'next' }
   ],
      [Op.and]: [
        { type3: { [Op.not]: null }},
        { type3: { [Op.ne]: 'no_issue' }},
        { next_item: 'next' }
    ],
    [Op.and]: [
      { type4: { [Op.not]: null }},
      { type4: { [Op.ne]: 'no_issue' }},
      { next_item: 'next' }
    ],
    [Op.and]: [
      { type5: { [Op.not]: null }},
      { type5: { [Op.ne]: 'no_issue' }},
      { next_item: 'next' }
    ]
    }

This looks to be correct but I'm obviously missing something. Thanks in advance!

1 Answers

Op.and should be an array of objects

      [Op.and]: [
         { type1: { [Op.not]: null }},
         { type1: { [Op.ne]: 'no_issue' }}
      ],...
Related