This is my API request body (Array of numbers):
{
"userIds": [10,11,12, 20]
}
Where the usersIds in DB is a number type and it’s not the primary or secondary keys.
I need to query DynamoDB and get the details of these users in NodeJs please.
I tried:
const keys: { userIds: number }[] = userIds.map(id => ({ userID: id }))
const params: BatchGetCommandInput = {
RequestItems: {
[this.tableName]: {
Keys: keys,
ProjectionExpression: projectionExpression
}
}
};
return ResultAsync.fromPromise(this.dynamoDocumentClient.batchGet(params),
I think that batchGet needs the keys to be passed so doesn’t work in this case!