Hey guys, I have my collection with the following indexes:
The problem is that no of my queries are using indexes, since it says 0 usage.
One example of query is:
Sale.aggregate([
{
$match: {
"createdAt": {
$gte: finalUnix
}
}
},
{
$project: {
contract: 1,
}
},
{
$group: {
_id: '$contract',
totalSales: { $sum: 1 }
}
},
{
$sort: {
"totalSales": -1
}
},
{
$limit: 10
}
])
This query should be using the createdAt index, shouldnt?
What am I doing wrong?