In database there are multiple hotels are available of the city same as that of query but I'm getting output as
[0,0,0] what's the problem, I'm not able to understand why this is happening?
`
exports.countByCity = async (req, res, next) => {
const cities = req.query.cities.split(",");
try {
const list = await Promise.all(
cities.map((city) => {
console.log(city);
return Hotel.countDocuments({city:city});
})
);
res.status(200).json(list);
} catch (err) {
next(err);
}
};
`