I have a collection of prices. Its size is about 2.5GB, with 2.1 million documents. It increases a little every day as I collect prices from different sources daily. I also run a daily fetch to get the prices and show them to my clients. Until yesterday, this would take around 30 seconds. Today, suddenly, it started taking around 7 minutes! The only operations I do are a $match and a $projection. For the $match I search for a productId and an array of storeIds. Can anyone help me??
Welcome to MongoDB community.
We would need to explore . explain for thd explain plans of the query. And query itself…
Additionally please provide a getIndexes() from your collection.
Now you mentioned storeIds array is this array saves all stores that has the product and kept in one product document??