简体   繁体   English

Dynamo db Error添加问题:{InvalidParameterType:Expected params.Item ['options']。S是一个字符串

[英]Dynamo db Error adding question: { InvalidParameterType: Expected params.Item['options'].S to be a string

I am using node js and my query to add an item is like this 我正在使用节点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"}
}

And my node js query is this. 我的节点js查询就是这个。

dynamodb.putItem(testq, function(err, testqdata) {
 if(err){
//Somthing
 }else{
 //Somthing
}

But this shows an error 但这显示错误

Error adding question: { 
InvalidParameterType: Expected params.Item['options'].S to be a string
}

How can I execute this query "options":{"S":["a. Panel1","b. panel2","c. panel3","d. panel4","e.panel5"]}, This is an object 如何执行此查询“选项”:{“S”:[“a.Panel1”,“b.citlate2”,“c。panel3”,“d.citform4”,“e.panel5”]},这是一个东西

You are using S ( String ), but trying to put Set/List of Strings , so try SS ( String Set ) instead. 您正在使用SString ),但尝试放置Set/List of Strings ,因此请尝试使用SSString Set )。

"options": {"SS": ["a. Panel1", "b. panel2"]}

Read more about String Set 阅读有关String Set的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM