title: MongoDB $lookup inside nested array performance & best practice issue
body: <p>In MongoDB I have:</p>
  
  <p>Collection <code>customers</code> with embedded array <code>orders</code>:</p>
  
  <pre><code>db.customers.insert([
  {_id: 1, name: "John", orders: [
    {articleId: 1, quantity: 10},
    {articleId: 2, quantity: 5}
  ]}]);
  </code></pre>
  
  <p>Collection <code>articles</code></p>
  
  <pre><code>db.articles.insert([
  {_id: 1, name: "computer"},
  {_id: 2, name: "bike"}
  ]);
  </code></pre>
  
  <p>This question is not about design. I investigated a lot into the design, so that is fixed for this question. The collections <code>customers</code>, <code>orders</code>, <code>articles</code> is not my real case. I just took it as an example.   </p>
  
  <p>I want this result:</p>
  
  <pre><code>{_id: 1, name: "John", orders: [
    {articleId: 1, name: "computer", quantity: 10},
    {articleId: 2, name: "bike", quantity: 5}
  ]}
  </code></pre>
  
  <p>I can get this result with the following query:</p>
  
  <pre><code>db.customers.aggregate([
    { $match: { "_id": 1 } },
    { $unwind: "$orders" },
    {
      $lookup: {
        from: "articles",
        localField: "orders.articleId",
        foreignField: "_id",
        as: "article"
      }
    },
    { $unwind: "$article" },
    { $addFields: { "orders.name": "$article.name" } },
    { $project: { article: 0 } },
    {
      $group: {
        _id: "$_id",
        name: { "$first": "$name" },
        orders: { "$push": "$orders" }
      }
    }
  ]);
  </code></pre>
  
  <p><strong>Is this the best possible query?</strong></p>
  
  <p>There are much more properties for every collection. And in case of a collection of 20 million <code>customers</code>. <code>customers</code> have an average of 50 <code>orders</code> per <code>customer</code>. And let say there are 80 <code>articles</code>. Also this query is running every minute. So I need to use as less resources as possible.  </p>
  
  <p><strong>Or is there a smarter query that has a better performance using less resources?</strong></p>