javascript - create a table with a global secondary index error -
i trying create table global secondary index using javascript sdk inside of nodejs:
var messagestableparams = { tablename : "messages", keyschema: [ { attributename: "to", keytype: "hash"}, //partition key { attributename: "tm", keytype: "range" } //sort key ], attributedefinitions: [ { attributename: "to", attributetype: "n" }, { attributename: "tm", attributetype: "n" } ], provisionedthroughput: { readcapacityunits: 10, writecapacityunits: 10 }, globalsecondaryindexes: [ { indexname: 'fr_indx', keyschema: [ { attributename: "fr", keytype: "hash"}, //partition key { attributename: "tm", keytype: "range" } //sort key ], attributedefinitions: [ { attributename: "fr", attributetype: "n" }, { attributename: "tm", attributetype: "n" } ], projection: { projectiontype: 'keys_only' }, provisionedthroughput: { readcapacityunits: 10, writecapacityunits: 10 } } ] }; dynamodb.createtable(messagestableparams, function(err, data) { if (err) { console.error("unable create table. error json:", json.stringify(err, null, 2)); } else { console.log("created table. table description json:", json.stringify(data, null, 2)); } });
but keep getting following error , table not created:
unable create table. error json: { "message": "unexpected key 'attributedefinitions' found in params.globalsecondaryindexes[0]",
"code": "unexpectedparameter", "time": "2016-01-07t18:51:11.659z" }
i have figured out! need remove attributedefinitions global index , add new entry 'fr' attribute table's attributedefinition!
i thank people have supported me through tough time , tolerated inexcusable language towards computer!
Comments
Post a Comment