title: How Do I group in Mongoose for categories
body: <p>My Data :</p>
  
  <p>I have category , Sub category 1 and sub category 2. I am storing each category by using parent_id. And the following is my data</p>
  
  <pre><code>{
      "_id" : ObjectId("000000005e712c388852b550"),
      "__v" : 0,
      "category" : "ewb",
      "created_date" : ISODate("2019-01-09T06:55:57.376Z"),
      "parent_id" : null,
      "status" : "Y",
      "type" : "Column"
  }
  {
      "_id" : ObjectId("000000005e712c388852b551"),
      "__v" : 0,
      "category" : "wealth",
      "created_date" : ISODate("2019-01-09T06:55:57.378Z"),
      "parent_id" : ObjectId("000000005e712c388852b550"),
      "status" : "Y"
  }
  
  {
      "_id" : ObjectId("000000005e712c388852b552"),
      "__v" : 0,
      "category" : "hh economic well-being",
      "created_date" : ISODate("2019-01-09T06:55:57.379Z"),
      "parent_id" : ObjectId("000000005e712c388852b551"),
      "status" : "Y"
  }
  </code></pre>
  
  <p>Now I have to print as</p>
  
  <pre><code>Category : [{
    category : 'ewb',
    "_id" : ObjectId("000000005e712c388852b550"),
    sub_cat1 : [{
      category : 'wealth',
      "_id" : ObjectId("000000005e712c388852b551"),
      sub_cat2 : [{
        category : 'hh economic well-being',
        "_id" : ObjectId("000000005e712c388852b552"),
        }]
      }]
  }]
  </code></pre>
  
  <p>Without changing the schema How do I achieve this. I refered SO </p>