Mongoose CastError Mongoose CastError mongoose mongoose

Mongoose CastError


You probably have a .post(':id', ...) on top of your code. So a post request to /testRequest matches the '/:id' and '/testRequest' routes, but only the top one executes.The ':id' route reads testRequest as an ID and throws the CastError.

You can swap the order of the methods, which was already discussed here.