Answer the question
In order to leave comments, you need to log in
How to make a selection OR on nested fields of a mongo document?
Hello!
I can't figure out how to write the following sample correctly. You need to find a document either by one nested field, or by the second. In my case, the first condition works - search by login. And by mail - no:
Groups.findOne({ $or: [ { 'users.login': req.body.userLogin }, { 'users.email': req.body.userLogin }]}, (err, group) => {
....
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