0
I’m trying to do this in my code and works perfectly on the localhost but on the Umbler server is giving error.
FOLLOWS THE ERROR:
MongoError: unknown top level operator: $expr
Follow the code I’m trying to do at Nodejs with Mongosse:
await model('UsoApi').find({
$and: [{
$or: [
{ userIdDaChave: body.userIdDaChave },
{ chaveUsada: body.chaveUsada }
]
},
{
"$expr": {
"$and": [
{ "$eq": [{ "$year": "$createdAt" }, mesAno[1]] },
{ "$eq": [{ "$month": "$createdAt" }, mesAno[0]] }
]
}
}]
}).sort({ createdAt: 'desc' });
Someone can help me?