0

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' }]
  })
Trang D
  • 333
  • 5
  • 16

2 Answers2

1

This answer works for me:

db.owner.findAll({ 
  where: {name: { $not: 'jack'}},
  include: [{ model: models.customer, as: 'customers' }]
});
niaS
  • 323
  • 4
  • 18
Trang D
  • 333
  • 5
  • 16
0

Check with this one

db.owner.findAll({({
    where : { name: {ne: 'jack'}},
    include: [{ model: models.customer, as: 'customers' }]
  });
Schüler
  • 512
  • 4
  • 10
  • 25