@Sohel_Kabirq , Since your instance is serverless and you dont have option to specify the allowDiskFlag . Try to avoid the querying large set of document that exceeds your client memory .
In the mentioned example , $match stage spans to 2 days . Try to reduce it or see if you can think other way around . A set of NoSQL patterns can help you in place .Looking at your query , it seems bucket pattern is a close one that suits your need
See Building with Patterns: The Bucket Pattern | MongoDB Blog
Other set of pattern can be found here , Building with Patterns: A Summary | MongoDB Blog
Its not always the case the you have to query the large set of collection for your need , you can avoid running into this kind of situation by planning your data model ahead .
1 Like