We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8.12.1
20.18.0
7.0.14
5.8.2
I'm having an issue with the findOne function. I'm trying to get some data with the slug, and I'm getting this error:
findOne
slug
CastError: Cast to ObjectId failed for value "<slug>" (type string) at path "_id" for model "<model>"
This is the function I'm using:
router.get("/product-slug/:slug", (req, res, next) => { return ProductModel.findOne({ slug: req.params.slug }) .then(foundProduct => res.status(200).json(foundProduct)) .catch(err => next(err)) })
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prerequisites
Mongoose version
8.12.1
Node.js version
20.18.0
MongoDB server version
7.0.14
Typescript version (if applicable)
5.8.2
Description
I'm having an issue with the
findOne
function. I'm trying to get some data with theslug
, and I'm getting this error:Steps to Reproduce
This is the function I'm using:
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: