title: How to optimise mongodb aggregate query?
body: <p>I have written a query to get all the data from a particular collection, lets call it collection A. Now the query needs data from other collection as well, so I wrote an aggregate query on collection A that gets data from collections B,C,D as well. The problem is all of these collections have over 100000 documents in them and because of this the query is taking a lot of time to execute. I tried adding indexes but I am still inexperienced in it so that didn't work as well.</p>
  <p>The structure of my aggregate query is like this</p>
  <p>$match --&gt; $project --&gt; $lookup --&gt; $unwind --&gt; $project --&gt; $group --&gt; $match --&gt; $group</p>
  <p>Since the query is too big I cannot post it here. Please help me out. Any suggestion will be grateful. Thank You</p>