title: Express Node js sort schema objects in route
body: <p>I created an application with Node js Express and I need know how to sort a schema object in the route controller. My Database is Mongo db. Here is my current working Code.</p>
  
  <pre><code>import express from 'express';
  import cors from 'cors';
  import bodyParser from 'body-parser';
  import mongoose from 'mongoose';
  import License from './models/license'
  
  const app = express();
  const router = express.Router();
  app.use(cors());
  app.use(bodyParser.json());
  mongoose.connect('mongodb://localhost/tnod');
  
  const connection = mongoose.connection;
  connection.once('open', () =&gt; {
      console.log('MongoDB database connection established successfully!');
  });
  app.use('/', router);
  
  router.route('/license').get((req, res) =&gt; {
      License.find((err, licenses) =&gt; {
          if(err)
              console.log(err);
          else
              res.json(licenses);
      });
  });
  </code></pre>
  
  <p>I need something like <code>License.sort({"votes":1}).find() ...</code> Tried in different ways. Not working! </p>
  
  <p>Somehow I need to sort the schema object given by <code>/license</code> route</p>