Search code examples
javascriptsequelize.jsfeathersjs

Sequelize AND condition object


I wanted to return field which matches all the query params using $and. It will only return true if it maches formId, respondent and receipient. How do we do this using $and in sequelize?. All must be true to return a result. Thank you.

 const Request = await context.service.Model.findOne({
    query: {
      formId: 2,
      respondentId: 252,
      recipientId: 197,
    },
  });

Solution

  • Did where not work?

     const Request = await context.service.Model.findOne({
        where: {
          formId: 2,
          respondentId: 252,
          recipientId: 197,
        },
      });