title: javascript query last items in dynamodb from aws lambda
body: <p>So I have a dynamodb table with a primary key <code>ID</code> and a secondary key <code>Time</code> which is a number/timestamp. Now I want to query the latest record of a particular ID. I tried to construct the parameters like this but don't know how to move forward to query the item with the largest <code>Time</code>.</p>
  
  <pre><code>function get_snapshot(id, callback){
      let params = {
          TableName: "Table1",
          KeyConditionExpression: "ID = :id and Time ", // here I stuck
          ExpressionAttributeValues: {
          ":id": id
          }
      }; 
      docClient.query(params, function(err, data){
          ... // process the fetched item here
      })
  }
  </code></pre>
  
  <p>I'm quite new to this field. There could be a lot of rookie mistakes. Any help is appreciated.</p>