title: How to make a LEFT JOIN using $lookup MongoDB
body: <p>I created the below view. I want to get all customers on orderheader with addresstype billing if not I still want the orderheader document. I think match stage is eliminating few documents as there is no address type billing for few documents.</p>
  
  <p>I mean its acting like INNER JOIN, instead I want LEFT JOIN. trying hard but all I'm getting is INNER JOIN.</p>
  
  <pre><code>    db.createView(
         "VWOrderHeader",
         "OrderHeader",
         [
          { 
            $lookup:{  
               from:"AddressDoc",
               as: "Address",
               localField: "CustomerNo",
               foreignField: "CustomerNo"
            }
          },
          {
              $match:{ "Address.AddressType":/Billing/i }
          },
          {
              $project:{
                  _id:0,
                  CustomerNo :"$CustomerNo",
                  ContactName:{ $ifNull:[{$arrayElemAt: [ "$Address.ContactName",0 ]},""]}
              }
          }
         ]
  )}
  </code></pre>