AWS Documentation Sucks, I can't seem to get an idea of how to "scan" DynamoDb with two or more where conditions, in NodeJS ?
Here's my code
const AWS = require("aws-sdk");
let documentClient = new AWS.DynamoDB.DocumentClient();
module.exports.RetryIncompleteCSV = async (event, context, callback) => {
console.log('In RetryIncompleteCSV');
const cmpId = event.queryStringParameters.campaign;
console.log('cmpId = ', cmpId);
var params = {
TableName : 'processed_csv_developments',
FilterExpression : 'campaignId = :campaignId',
ExpressionAttributeValues : {':campaignId' : cmpId}
};
let incompleteCsvData = await scanIncompleteProcessedCsv(params);
console.log('incompleteCsvData = ', incompleteCsvData);
}
async function scanIncompleteProcessedCsv(params) { // get method fetch data from dynamodb
console.log(params)
const queryExecute = await documentClient.scan(params, function(err, data) {
if (err) console.log(err);
else console.log(data);
console.log('queryExecute=',queryExecute)
});
}
I need scan to filter out data, based on following two conditions:
- campaignId must be equal to the campaignId that I get from query params.
- isComplete should be equal to false (Boolean)
The code written above neither give any error nor a success message. Attaching the cloudwatch logs screenshot below :
What am I missing. I looked at a lot of questions and tutorials, but nothing worked for me. Please Help!