title: Why is DynamoDB LastEvaluatedKey depends on the limit of the query?
body: <p>Using javascript aws-sdk and querying a dynamodb table, with document client. the table contains <strong>10 elements</strong> and the query <strong>limit = 5</strong>. </p>
  
  <p>For each request I use the LastEvaluatedKey to build a new query and send a fresh request, here are the results :</p>
  
  <pre><code>first request --&gt; {Items: Array(5), Count: 5, ScannedCount: 5, LastEvaluatedKey: {…}}
  second request --&gt; {Items: Array(5), Count: 5, ScannedCount: 5, LastEvaluatedKey: {…}}
  third request --&gt; {Items: Array(0), Count: 0, ScannedCount: 0}
  </code></pre>
  
  <p>According to this <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.Pagination" rel="noreferrer">doc</a> </p>
  
  <blockquote>
    <p>If the result contains a LastEvaluatedKey element, proceed to step 2. 
    <strong>If there is not a LastEvaluatedKey in the result, then there are no
    more items to be retrieved</strong></p>
  </blockquote>
  
  <p>It is supposed to not return <em>LastEvaluatedKey</em> in the second request, cause there is no more elements, but it returns one which send to an empty result in the third request.</p>
  
  <p>When i try with <strong>limit = 4</strong>, every things works as expected</p>
  
  <pre><code>first request --&gt; {Items: Array(4), Count: 4, ScannedCount: 4, LastEvaluatedKey: {…}}
  second request --&gt; {Items: Array(4), Count: 4, ScannedCount: 4, LastEvaluatedKey: {…}}
  third request --&gt; {Items: Array(2), Count: 2, ScannedCount: 2} &lt;--- there is no LastEvaluatedKey as expected
  </code></pre>
  
  <p>So what is happening here ?</p>