title: how to use mongoose pagination with populate and query
body: <p>I'm trying use mongoose pagination to process advance search with pagination.</p>
  
  <p>I have the following schemas:</p>
  
  <pre><code>const authorSchema = Schema({
    _id: Schema.Types.ObjectId,
    name: {type: String, unique: true},
  });    
  const Author = mongoose.model('author', authorSchema, 'author');
  
  const bookSchema = Schema({
  _id: Schema.Types.ObjectId,
  name: String,
  authors:[{type: Schema.Types.ObjectId, ref: 'author'}]
  });
  const Book= mongoose.model('book', bookSchema , 'book');
  </code></pre>
  
  <p>I want to find 24 book for page 1 with any book contains author name 'jean'. I do the following with <a href="https://github.com/edwardhotchkiss/mongoose-paginate" rel="nofollow noreferrer">mongoose-paginate</a> module:</p>
  
  <pre><code> Book.paginate({}, {
      page: 1,
      limit: 24,
      populate: {
       path: 'authors',
       select: 'name',
       match: {
          name: 'jean'
       }
      }, function (err, books) {
          res.json(books);
      });
  </code></pre>
  
  <p>But the result books contains other book with authors array empty. I cant use books.filter() to remove book with authors. But if i do that, i can't have 24 book per page on result.</p>
  
  <p>What is the right way to do that?</p>