title: ReactiveMongo Pagination with Count
body: <p>I am trying to implement Pagination with Reactive Mongo.</p>
  
  <pre><code>def get(page: Int, pageSize: Int, filter: JsObject = Json.obj()): Future[Seq[Thing]] = {
      val actualPage = if(page &gt; 1) page else 1
      collection
        .find(filter)
        .options(QueryOpts(skipN = (actualPage - 1) * pageSize, batchSizeN = pageSize))
        .cursor[Thing]()
        .collect[Seq](pageSize, Cursor.FailOnError[Seq[Thing]]())
  }
  </code></pre>
  
  <p>This works and returns me a sequence of documents filtering by the <code>page</code> and <code>pageSize</code>. The problem is I have no idea how many results match the specified query, so I cant tell how many <code>page</code>'s exist.</p>
  
  <p>Is there a way I can also get a <code>$count</code> as part of the same query? Or do I need to resort to querying the database a second time with the below? </p>
  
  <pre><code>collection.count(filter)
  </code></pre>
  
  <p>Ideally I would change my return type to <code>Future[Page[Seq[Thing]]]</code> where <code>Page</code> would contain the total result count. e.g. </p>
  
  <pre><code>case class Page[T](results: Seq[T], count: Int)
  </code></pre>