Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

begins_with node js AWS dynamodb sort key

let AWS = require('aws-sdk');
let util = require('util');

AWS.config.update({
    region: 'us-east-1'
});

let connection = new AWS.DynamoDB.DocumentClient();

let params = {
    TableName: 'user_details',
    KeyConditionExpression: 'user_id = :user_id and user_relation begins_with :user_relation',
    ExpressionAttributeValues: {
        ':user_id': "1234",
        ':user_relation': "followed-by"
    }
};

console.log('getQuery Params => ', params);
let dynamoDb = util.promisify(connection.query).bind(connection);
let results = await dynamoDb(params);
console.log('results => ', results);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #node #js #AWS #dynamodb #sort #key
ADD COMMENT
Topic
Name
2+7 =