title: Azure CosmosDB Unexpected Pagination Behaviour
body: <p>We are using CosmosDb C# SDK<br>
  We tried both: "Microsoft.Azure.Cosmos 3.4.1", "Microsoft.Azure.DocumentDB.Core 2.9.1 and 2.4.2"<br>
  We are getting invalid results and the main problems is the ResponseContinuation </p>
  
  <blockquote>
    <p>[{"token":null,"range":{"min":"05C1DFFFFFFFFC","max":"FF"}}]</p>
  </blockquote>
  
  <p>This started showing in one of our smaller service with only 14 documents. </p>
  
  <p>In all queryes we use the folowing headers:  </p>
  
  <ul>
  <li>"x-ms-documentdb-query-enablecrosspartition" = true</li>
  <li>"x-ms-max-item-count" = 100</li>
  </ul>
  
  <p><strong>Query 1:</strong><br>
  The query is the folowing <code>SELECT * FROM c</code>.<br>
  We get the folowing response:<br>
   - 7 items<br>
   - ResponseContinuation <code>[{"token":null,"range":{"min":"05C1DFFFFFFFFC","max":"FF"}}]</code>  </p>
  
  <p>Then we use the continuation token to get the other 7 items.</p>
  
  <p><strong>Query 2:</strong>   </p>
  
  <p>If we modify the query to <code>SELECT * FROM c ORDER BY c.property ASC</code>, the order gets messed up! (responses are simplified)<br>
  - we get the folowing result ["A", "B", "C", "D", "F"]<br>
  - and the second query ["C", "D", "G"]</p>
  
  <p><strong>Query 3:</strong><br>
  if we want to find only one item <code>SELECT TOP 1 * FROM c WHERE c.name = @name</code>, and the item is in the "second query result"<br>
  - nothing and RequestContionuation <code>{"top":1,"sourceToken":"[{\"token\":null,\"range\":{\"min\":\"05C1DFFFFFFFFC\",\"max\":\"FF\"}}]"}</code></p>
  
  <p>This is all a really unexpected behaviour.<br>
  Why does ORDER BY, TOP even exist if we can't even use it properly..<br>
  We can't afford to list all data from cosmos to our server and then do ordering, expecialy on bigger containers.</p>
  
  <p>Edit: github issue link: <a href="https://github.com/Azure/azure-cosmos-dotnet-v3/issues/1001" rel="nofollow noreferrer">https://github.com/Azure/azure-cosmos-dotnet-v3/issues/1001</a></p>