'An issue occurred while attempting to convert the value "{ userId: '5c48a95df9bd9a33c0ff9405', username: 'ahsan', iat: 1549024353, exp: 1549110753 }" to an ObjectId for the "user" path in the "Rental" model'
router.get("/manage", UserControl.loginMiddleware, (req, res) => {
const user = res.locals.user;
Rental.where({ user })
.populate("bookings")
.exec((err, foundRentals) => {
if (err) {
return res.status(422).send({ errors: mongoErrors(err.errors) });
}
return res.json(foundRentals);
});
});