Search code examples
postgresqlexceptsequelize-cli

how to retrieve all records from sequelize PostgreSQL except a specific value?


I want to retrieve all the records except a specific value, I tried the below query but I am not getting the required output.

db.owner.findAll({ exclude: { model : models.owner.name: 'jack'}, 
    include: [{ model: models.customer, as: 'customers' }]
  })

Solution

  • Check with this one

    db.owner.findAll({({
        where : { name: {ne: 'jack'}},
        include: [{ model: models.customer, as: 'customers' }]
      });