Answer the question
In order to leave comments, you need to log in
How to add a selection condition?
Good day.
The code below selects news from the collection by username.
How to supplement the selection condition also by the user's last name?
It should be taken into account that the surname is not indicated for all users, i.e. somewhere it simply can not be!
Condition: если req.body.name
or req.body.surname
found in b.d.
News.find({ name: req.body.name })
.select()
.exec()
.then(dev => {
if (dev.length >= 1) {
res.status(200).json({
"result":"ok"
});
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question