title: mongodb sorted order insertion using Mongoose in nodejs
body: <p>I have a mongoose schema shown below</p>
  
  <pre><code>var testdata = new Test({
          Product_Type: 10, 
          Product_ID: 'GPR',
          attrib: [   
                      {
                          Year:2017,
                          Month: 3
                      },
                      {
                         Year:2011,
                         Month: 3
                      },
                      {
                          Year:2012,
                          Month: 3
                      },
                      {
                          Year:2015,
                          Month: 3
                      }
                  ],
      });
  
  testdata.save(function(err, testdata) {
    if(err){
        console.log('saving data error',err);
    }else{
         res.status(200).json({'msg':'Data inserted'});
    }
  
  });
  </code></pre>
  
  <p>When I'm checking from mongodb attrib information is storing as it is given in schema, but I want attrib store in mongodb like below</p>
  
  <pre><code>   {
          Year:2017,
          Month: 3
      },
      {
          Year:2015,
          Month: 3
      },
      {
          Year:2012,
          Month: 3
      },
      {
         Year:2011,
         Month: 3
      }
  </code></pre>
  
  <p>I want atrrib information will store in descending order by Year and Month </p>