I have my collection with less than 10.000 documents and Im running the following query:
Sale.aggregate([
{
$match: {
seller,
createdAt: {
$gte: finalUnix
}
}
}
])
Seller and createdAt are string and they are already indexes of the collection. This simple query is taking more than 10 seconds to be executed. I have less than 10.000 documents and this query returns less than 1.000 documents.
Why is it taking so long?
Running a query only with $match (matching a string, index too) takes more than 10 seconds in MongoDB Compass too.