title: how to filter and limit dynamodb data with lambda and api gateway?
body: <p>I am using amazon dynamodb, lambda and api gateway services. I have a table in dynamodb call photo-group and it's Primary key is pid and other data such ownerid, photosrc,photosize etc.</p>
  
  <p>I know how to use scan to get the data like:</p>
  
  <pre><code>   var data = JSON.stringify({
              "operation":'list',
              "TableName":"photo-group",
              "FilterExpression": "ownerid = :val)",
              "ExpressionAttributeValues": {":val": user}
  });
  </code></pre>
  
  <p>But now I try to limit the result to get only 30 items by adding "Limit:30". I found that scan will scan the first 30 rows for me and not return 30 items to me. May I know how to filter 30 items by ownerid?</p>
  
  <p>Thank you so much!</p>