title: Group mongo collection based on a value if present else dont group, show it as it is
body: <p>I want to group the following collection by "Company" attribute, only if Company attribute is available else don't group show as it is</p>
  
  <p>Here is my collection.</p>
  
  <pre><code>{
      "_id":"Wagon R",
      "type": "Car",
      "Company": "Suzuki"
  },
  {
      "_id":"Ertiga",
      "type": "Car",
      "Company": "Suzuki"
  },
  {
      "_id":"Accent",
      "type": "Car",
      "Company": "Hyundai"
  },
  {
      "_id":"Camry",
      "type": "Car",
      "Company": "Toyoto"
  },
  {
      "_id":"Corollo",
      "type": "Car",
      "Company": "Toyoto"
  },
  {
      "_id":"M 800",
      "type": "Car",
      "Company": ""
  },
  {
      "_id":"E 800",
      "type": "Car",
  },
  {
      "_id":"X 800",
      "type": "Car",
  }
  </code></pre>
  
  <p>The sample output required.</p>
  
  <pre><code>{
      "_id":"Wagon R",
  },
  {
      "_id":"Accent",
  },
  {
      "_id":"Camry",
  },
  {
      "_id":"M 800",
  },
  {
      "_id":"E 800",
  },
  {
      "_id":"X 800",
  }
  </code></pre>
  
  <p>I tried with grouping, but its giving the collection which only has company attribute. I also want the records which doesnt have company attribute
  Can someone please help</p>
  
  <pre><code>    {
          "$match" : ----
      },
  
      {
        "$group": {
          "_id": "$Company",
          "doc": {"$first":"$$ROOT"}
  
  
        }
      },
      {
          "$replaceRoot": {"newRoot":"$doc"}
      }
  </code></pre>