I have this route:
// FIXME: This rotes has a unknown bug
router.get('/unverified', async (req, res) => {
try {
const unverifiedUsers = await User.find(
{ is_verified: false, is_admin: false },
{ name: 1, code: 1, email: 1, gender: 1 }
);
return res.status(200).json(unverifiedUsers);
} catch (error) {
return res.status(400).send({ error });
}
});
And I use it like this:
app.use('/api/users', userRoute);
Everytime I go to http://localhost:5000/api/users/unverified
I got this:
{
"error": {
"stringValue": "\"unverified\"",
"kind": "ObjectId",
"value": "unverified",
"path": "_id",
"reason": {}
}
}
It's strange to me because the other routes work perfectly and that error doesn't give me a reason.