title: MongoDB pagination with document modified date
body: <p>I am implementing a stream of sort, which is storing data like below </p>
  
  <pre><code>{_id:ObjectId(), owner:1, text:"some text1", created:"2015-11-14T01:01:00+00:00", updated:"2015-11-14T01:01:00+00:00"}
  {_id:ObjectId(), owner:1, text:"some text2", created:"2015-11-14T01:01:00+00:00", updated:"2015-11-14T01:01:00+00:00"}
  {_id:ObjectId(), owner:1, text:"some text3", created:"2015-11-14T01:01:00+00:00", updated:"2015-11-14T01:02:00+00:00"}
  ...
  {_id:ObjectId(), owner:1, text:"some text4", created:"2015-11-14T01:30:00+00:00", updated:"2015-11-14T01:31:00+00:00"}
  ...
  </code></pre>
  
  <p>Note that there is frequent bulk update, which means there can be more than 10-20 documents updated at the same time.</p>
  
  <hr>
  
  <p>My aggregation query looks like this </p>
  
  <pre><code>db.stream.aggregate([
      $match: { 
          'owner': 1, 
          'updated': { $lte: '2015-11-14T01:30:00+00:00' } },
      $sort: { 'updated': -1 },
      $limit: 10
  ]) 
  </code></pre>
  
  <p>If there are more than 10 objects with same updated date my pagination will not continue.</p>
  
  <p>for pagination I have last document of previous page 
  I can extract <code>_id</code> and <code>updated</code></p>
  
  <p>Is it possible to do something like </p>
  
  <pre><code>$match : {updated :{ $lt: last_page_ele.updated} }
  $sort : { updated }
  $match : { `documents which comes after the last element in this order` }
  $limit : 10 
  </code></pre>
  
  <hr>
  
  <p><strong>Update:</strong> </p>
  
  <p>It is possible to use the method suggested by @Blakes Seven, i.e to store all the <code>seen</code> documents in a session array and use <code>$nin</code>. This was an obvious solution, but it screws up my front end behaviour. You cannot open multiple tabs, which will use the same session space used by the other tab. </p>
  
  <p>Plus in my case storing 100s of items in RAM seems to be impractical and not scalable for lot of users.</p>