title: MongoDB how to add conditional $match condition
body: <p>I have the following schema</p>
  
  <pre><code>{
     f1: "test",
     f2: "something",
     type: "A",
     date: "2018-11-01T00:00:00.000Z",
     deleted: false
  },
  {
     "f1": "check",
     type: "B",
     deleted: false
  }
  </code></pre>
  
  <p>Now what I want is to get all data, and if <code>type = "A", then add an extra condition to my match query, suppose compare its date with current date</code>.
  My current query is:</p>
  
  <pre><code>db.getCollection('myCollection').aggregate([
    {$match:{
          {"deleted":false},
          // I want to check if type is A then compare its date 
    }}
  ])
  </code></pre>