Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. const AWS = require('aws-sdk');
  2. const docClient = new AWS.DynamoDB.DocumentClient();
  3.  
  4. exports.handler = async (event) => {
  5.  
  6. let params4 = {
  7. TableName: "pool4-dev",
  8. IndexName: "index-datetime",
  9. KeyConditionExpression: "#date = :dateValue",
  10. FilterExpression: "#idx1 = :idx1 AND begins_with(#id,:id) ",
  11. ExpressionAttributeNames: {
  12. "#date": "date",
  13. "#idx1": "idx1",
  14. "#id": "id"
  15. },
  16. ExpressionAttributeValues: {
  17. ":dateValue": '2019-01-01',
  18. ":idx1": 'WELL-34243-234243',
  19. ":id": "DATAPOINTDATA"
  20. }
  21. };
  22. // console.log("params4===========", params4);
  23. try {
  24. var data = await docClient.query(params4).promise();
  25. console.log("data.Items ============", data.Items);
  26. } catch (err) {
  27. console.log(err);
  28. return err;
  29. }
  30.  
  31. // TODO implement
  32. const response = {
  33. statusCode: 200,
  34. body: JSON.stringify('Hello from Lambda!'),
  35. };
  36. return response;
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement