aws sdk - GetItem with DynamoDB via AWS SDK Javascript -
i've written following code using dynamodb:
var qryitem = { tablename: 'mytable', key: { userid: { s: '1234567' } } }; dynamodb.getitem(qryitem, function (error, data) { console.log(data); if(error){ console.log(error, error.stack); } });
the table mytable
has following attributes:
- userid (string) primary partition key
- name (string) primary sort key
- email (string)
i've executed scan
operation, when execute getitem
request above, following error returned:
validationexception: provided key element not match schema
any advice appreciated.
so yeah, always, read documentation thoroughly before passing go.
i specified "sort key" when created table , must pass in when perform query , must populated in order validation schema clear.
so query parameters should like:
var qryitem = { tablename: 'mytable', key: { userid: { s: '1234567' }, name: { s: 'john citizen' } } };
Comments
Post a Comment