yandex
loader

please wait

  • Liza Sain Feb-12-2019 05:36:40 AM ( 3 months ago )

    I need to find the data using same field on mysql, but different values. but i geetting empty values in response.

    I tried the $and condition to find the data on sequelize. but it getting not data in response.

    exports.multibranchdata = (req, res) => {
    
     const wherequery = { 
                 $and: [{ id: { eq: 1 } },
                        { id: { eq: 2 } }
                       ] };
     branch.findAll(wherequery)
    
    .then(data => res.status(200).send(data))
    
    .catch(Sequelize.ValidationError, err => 
     res.status(422).send(err.errors[0].message))
    
    .catch(err => res.status(400).send(err.message));
     };
  • Priyanka Chadda Feb-12-2019 05:38:36 AM ( 3 months ago )

    Try OR query :-

     const wherequery = { 
                 $or: [{ id: { eq: 1 } },
                        { id: { eq: 2 } }
                       ] };

Please login

Similar Discussion

Recommended For You