Query condition missed key schema element : Validation Error

前端 未结 4 2006
Happy的楠姐
Happy的楠姐 2021-01-01 08:57

I am trying to query dynamodb using the following code:

const AWS = require(\'aws-sdk\');

let dynamo = new AWS.DynamoDB.DocumentClient({
  serv         


        
4条回答
  •  生来不讨喜
    2021-01-01 09:22

    i solved the problem using AWS.DynamoDB.DocumentClient() with scan, for sample (nodejs):

    var docClient = new AWS.DynamoDB.DocumentClient();
    var params = {
            TableName: "product",
            FilterExpression: "#cg = :data",
            ExpressionAttributeNames: {
                "#cg": "categoria",
            },
    
            ExpressionAttributeValues: {
                 ":data": category,
            }
        };
    
    docClient.scan(params, onScan);
    
        function onScan(err, data) {
            if (err) {
                // for the log in server
                console.error("Unable to scan the table. Error JSON:", JSON.stringify(err, null, 2));
                res.json(err);
            } else {
    
                console.log("Scan succeeded.");
                res.json(data);
    
            }
        }
    

提交回复
热议问题