When I put this url {{URL}}api/v1/tours?duration[$gte]=10 into postman console.log(req.query) always returns {duration: {}}
exports.getAllTours = async (req, res) => {
try {
const query = Tour.find(req.query);
console.log(req.query);
const tours = await query;
res.status(200).json({
status: 'success',
data: { tours },
});
} catch (err) {
res.status(404).json({
status: 'fail',
message: err,
});
}
};
req.query returns {duration: {}}
I think it has something to do with the schema I am using but I cannot figure out what I need to change