-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
ddbdoc_query.js
executable file
·34 lines (29 loc) · 1.07 KB
/
ddbdoc_query.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at
// https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/dynamodb-example-document-client.html
// snippet-start:[dynamodb.JavaScript.docClient.query]
// Load the AWS SDK for Node.js
var AWS = require("aws-sdk");
// Set the region
AWS.config.update({ region: "REGION" });
// Create DynamoDB document client
var docClient = new AWS.DynamoDB.DocumentClient({ apiVersion: "2012-08-10" });
var params = {
ExpressionAttributeValues: {
":s": 2,
":e": 9,
":topic": "PHRASE",
},
KeyConditionExpression: "Season = :s and Episode > :e",
FilterExpression: "contains (Subtitle, :topic)",
TableName: "EPISODES_TABLE",
};
docClient.query(params, function (err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Success", data.Items);
}
});
// snippet-end:[dynamodb.JavaScript.docClient.query]