Mongoose operando encontrar método
const docs = await Character.find({
$and: [
{
$or: [
{ age: { $gte: 29 } },
{ rank: 'Commander' }
]
},
{
$or: [
{ name: { $lte: 'D' } },
{ name: { $gte: 'W' } }
]
}
]
});
// ['William Riker']
docs.map(doc => doc.name).sort();
Scary Sardine