title: Mongoose find all documents where array.length is greater than 0 & sort the data
body: <p>I am using mongoose to perform CRUD operation on MongoDB. This is how my schema looks.   </p>
  
  <pre><code>var EmployeeSchema = new Schema({
        name: String,
        description: {
          type: String,
          default: 'No description'
        },
        departments: []
  
      });
  </code></pre>
  
  <p>Each employee can belong to multiple department. Departments array will look like [1,2,3]. In this case departments.length = 3. If the employee does not belong to any department, the departments.length will be equal to 0.</p>
  
  <p>I need to find all employee where EmployeeSchema.departments.length > 0 &amp; if query return more than 10 records, I need to get only employees having maximum no of departments. </p>
  
  <p>Is it possible to use Mongoose.find() to get the desired result?</p>