When i call this query, in production environment / database, this query is taking so long time, like 8-10s. I did my research and it seems it’s because i have 800+ documents in my collection, and mongo is doing a “collectionScan” to get the push with the good authors.
so i’ve read that to get better performance, i have to create an indexe. So to me, it’s relevant to make an indexe by “author.slug”, because it’s how i call the collection, with the query above . i created it with this command
db.pushs.createIndex({"author.slug": 1})
But with this one, nothing change, the query is taking the same time? what did i wrong ?
To have better understanding on the issue being seen, could you please confirm with the following details which would help in reproducing the issue in local
Can you specify the sample data for which query is being applied for as the index specified is not seen in the screenshot attached.
for the rest, i’m using strapi for my backend, so idk where i can find this informations, it seems it do it for me
but there is my question, can i create a index of the pushs collection, order by author.slug, where author is a another collection and slug a fields of a user ?
if yes, how ? because it seems the db.pushs.createIndex({“author.slug”: 1})` don’t work, don’t increase performance on my query