I'm trying to filter using multiple items in a nested object in mongoose. The model is like this:
{
name: String
...
links: [{url: String, canQuery: bool}]
}
I'm trying to make a filter condition to do $or
and an and operator like this:
name: req.params.name,
// and either
'links.url': {$ne:req.params.url},
// or
'links.url': req.params.url, 'links.canQuery': false
Not sure the correct way to go about it. I know there's a $or
operator, but don't know how to use it together with ands...
question from:
https://stackoverflow.com/questions/65851600/use-or-together-with-and-operators-in-mongoose 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…