title: Bookshelf.js fetch rows with related (joined) tables - limiting number of related rows
body: <p>I am trying to achieve pagination in Bookshelf.js, and limit not just the number of models (<strong>Author</strong> in my code), but also the number of items in every model (<strong>books</strong> in my code).</p>
  
  <p>Here is the code:
  </p>
  
  <pre class="lang-js prettyprint-override"><code>Author.where('postedBy', userId).fetchPage({
      pageSize: 10,
      page: 1,
      withRelated: [
          { 'books': function(qb) { qb.limit(10) } }
      ]
  })
  </code></pre>
  
  <p>So, what I expect is:</p>
  
  <pre class="lang-js prettyprint-override"><code>{ author_1: [ book_1, ..., book_10 ], ..., author_10: [ book_1, ..., book_10 ] }
  </code></pre>
  
  <p>But instead I get:</p>
  
  <pre class="lang-js prettyprint-override"><code>{ author_1: [ book_1, ..., book_7 ], author_2: [ book_1, ..., book_3 ], author_N: [/*8 other collections are empty*/] }
  </code></pre>
  
  <p>So it just limits the total number of Authors to 10, AND overall number of items in the query to 10.
  Instead I want to have 10 Authors and up to 10 books in every author's collection.</p>
  
  <p>Is there a way to achieve that with Bookshelf.js &amp; Knex.js?</p>