In the following Typescript code, how can I specify which fields should be present in my Query Items Result?
const request: DynamoDB.DocumentClient.QueryInput = {
TableName: UnsubscriptionTokensRepository.TABLE_NAME,
IndexName: 'TokenIndex',
KeyConditionExpression: 'unsubscriptionToken = :unsubscriptionToken',
ExpressionAttributeValues: {
':unsubscriptionToken': token
}
};
const result = await this._documentClient.query(request).promise();
return result.Items[0].id;
The DynamoDB results include objects with various keys. In this example, I am referring to the id
field on the last line which may not be recognized by Typescript.