Is there any way of connecting appsync to dynamodb with option to put multiple items at once? I'm asking about dynamodb reuqest mapping.
Let's say we have saveVotes mutation
type Mutation {
saveVotes(votes: [VoteInput]): [Vote]!
}
How should I design dynamo request template to get each vote saved as separate object in the dynamodb? Each VoteInput has ID. I'm sending 5 VoteInput, and I want to have 5 separate object, with separate ID in the dynamodb. In the AWS docs there are examples just for single putItem which is not enough for me https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html#aws-appsync-resolver-mapping-template-reference-dynamodb-putitem
PutItem
, does yourPutItem
operation needs aconditionExpression
? If not, then you can use AWS AppSyncBatchPutItem
operation. There is a tutorial here on how to use it docs.aws.amazon.com/appsync/latest/devguide/…. - Tinou