0

When trying to request the id I'm having this error pop up:

const castError = new CastError();.
stringValue: '"6317861ce9acfa3f2d2101a3 "',
kind: 'ObjectId',
value: '6317861ce9acfa3f2d2101a3 ',
path: '_id',

I believe this error is popping up because there is an extra space at the end of the ID but have no idea why the space is being added. If more code is needed to find the solution to this error let me know.

router.put('/:id', async (req, res, next) => {
    req.article = await Article.findById(req.params.id);
    next();
}, saveArticleAndRedirect('edit'))
Youssouf Oumar
  • 29,373
  • 11
  • 46
  • 65

0 Answers0