我正在使用 node js,我的添加项目的查询是这样的
{
"TableName":"testquestions",
"Item":{"testid":{"S":"[object Object]"},
"questionid":{"S":"31478b20-d2a1-11e8-b6a9-756540a0ef19"},
"answer":{"S":"2"},
"options":{"S":["a. Panel1","b. panel2","c. panel3","d. panel4","e.panel5"]},
"questiontxt":{"S":"Googler"}
}
我的 Node js 查询是这样的。
dynamodb.putItem(testq, function(err, testqdata) {
if(err){
//Somthing
}else{
//Somthing
}
但这显示错误
Error adding question: {
InvalidParameterType: Expected params.Item['options'].S to be a string
}
我如何执行此查询 "options":{"S":["a.Panel1","b.panel2","c.panel3","d.panel4","e.panel5"]} , 这是一个对象
最佳答案
你正在使用 S
(String
),但试图放入 Set/List of Strings
,所以试试 SS
(String Set
) 代替。
"options": {"SS": ["a. Panel1", "b. panel2"]}
Read more about String Set
关于javascript - Dynamo db Error adding question : { InvalidParameterType: Expected params. Item ['options' ].S 是一个字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52869081/