I wrote code in node.js for find result from model mongoDB use mongoose but i want get the result that include status equal waiting or accepted
This is my code that finds me results with waiting status
const Booking= require('../model/Booking')
displayBookings: async(req,res)=>{
console.log('ok get')
try {
Booking.find({owner:req.params.id, status:'waiting'}).populate('driver').exec((err,result)=>{
if(result){
res.json({result:result})
}
else
res.json({error:err})
})
} catch (err) {
res.json(err)
}
},
And this my routing code
const ControllerBooking=require('../conroller/booking')
router.get('/displayBookings/:id', ControllerBooking.displayBookings)
Booking.find({ owner: req.params.id,
status: { $in: ['waiting', 'accepted']} })