Answer the question
In order to leave comments, you need to log in
How to filter data search with find()?
I have a Post model that contains the field "postId" : "1"
I send a request and I want to find in the model exactly the postId from the request in the postId field
This option const post = await Post.find({ postId:postId}) did not work
router.put("/:postId/edit", async (req, res) => {
try {
const post = await Post.find(как вписать фильтры)
.
} catch(err) {
...
}
})
Answer the question
In order to leave comments, you need to log in
What type of field? Number? So the query parameter must be brought to a number.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question