title: Paging with CosmosClient in CosmosDB
body: <p>I'm trying to implement paging using the SDK v3 <code>CosmosClient</code> instead of the old <code>DocumentClient</code>.</p>
  
  <p>Reason for this is it seems <code>DocumentClient</code> doesn't translate LINQ queries that contains spatial functions very well (ie: When using <code>Within()</code> I'll get an error from DocumentClient stating the methods is not implemented).</p>
  
  <p>Paging works well with <code>DocumentClient.CreateDocumentQuery&lt;T&gt;</code> as such:</p>
  
  <pre><code>var query = DocumentClient.CreateDocumentQuery&lt;T&gt;(UriFactory.CreateDocumentCollectionUri("master", "features"), feedOptions)
                  .Where(t =&gt; t.Type == typeof(T).Name)
                  .Where(pred)
                  .AsDocumentQuery();
  
  string queryContinuationToken = null;
  var page = await query.ExecuteNextAsync&lt;T&gt;();
  if (query.HasMoreResults)
      queryContinuationToken = page.ResponseContinuation;
  </code></pre>
  
  <p>I'm at a little loss as to where to gather a continuation token using <code>CosmosClient</code> and its <code>Container</code> class:</p>
  
  <pre><code>QueryRequestOptions options = new QueryRequestOptions();
  options.MaxItemCount = maxRecords;
  
  FeedIterator&lt;T&gt; feed;
  
  if (continuationToken == "")
      feed = Container.GetItemLinqQueryable&lt;T&gt;(true, null, options).Where(x =&gt; x.Type == typeof(T).Name).Where(pred).ToFeedIterator();
  else
      feed = Container.GetItemLinqQueryable&lt;T&gt;(true, continuationToken, options).Where(x =&gt; x.Type == typeof(T).Name).Where(pred).ToFeedIterator();
  </code></pre>
  
  <p><code>FeedIterator</code> seems to have some of the members <code>IDocumentQuery</code> has (like <code>HasMoreResults</code>) but I can't find a continuation token anywhere.</p>
  
  <p>What am I missing?</p>