sample data and postman req image I am sending “get” request on Postman. Unfortunately, there is no luck and I can’t find the mistake. Here is my factory.js :
exports.getOne = (Model, popOptions) =>
catchAsync(async (req, res, next) => {
console.log('GET ONE');
let query = Model.findById(req.params.id);
if (popOptions) query = query.populate(popOptions);
const doc = await query;
if (!doc) {
return next(
new AppError('No documents fond with that id', 404)
);
}
res.status(200).json({
status: 'success',
data: {
data: doc,
},
});
});
controller :
exports.getTourById = factory.getOne(Tour, { path: 'reviews' });
I tried to change controller and at the end no luck ana here is sample data in my DB.