This code returns the whole set of items, where I need only the count of it. Is it possible to get only the count of the items for this index?
AWSDynamoDBObjectMapper *objectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
AWSDynamoDBQueryExpression *queryExpression = [AWSDynamoDBQueryExpression new];
queryExpression.indexName = @"getVideoViews";
queryExpression.keyConditionExpression = @"#videoId = :val";
queryExpression.expressionAttributeNames = @{
@"#videoId" : @"videoId",
};
queryExpression.expressionAttributeValues = @{
@":val": videoId,
};
__weak typeof(self) weakSelf = self;
[objectMapper query:[ViewedVideos class]
expression:queryExpression
completionHandler:^(AWSDynamoDBPaginatedOutput * _Nullable response, NSError * _Nullable error) {
if (!error) {
dispatch_async(dispatch_get_main_queue(), ^{
if ([weakSelf.delegate respondsToSelector:@selector(serverConnectionHandlerReceivedNumberOfVideoViews:)]) {
[weakSelf.delegate serverConnectionHandlerReceivedNumberOfVideoViews:3];
}
});
}
}];
Like here for example:
aws dynamodb scan --table-name <TABLE_NAME> --select "COUNT"