Posts

Showing posts with the label scan

Guide to Querying and Pagination with AWS DynamoDB in NestJS

Image
Introduction In my previous article, I provided a basic guide on initializing and using AWS DynamoDB, but in this article, we will delve deeper into QueryCommand. In AWS DynamoDB, the Query method allows you to search for data based on the primary key (Partition Key) and filter conditions (Sort Key). To optimize performance and cost, DynamoDB supports a Pagination mechanism through the ExclusiveStartKey and LastEvaluatedKey parameters. Applying pagination not only reduces the data transfer load but also enables the application to handle large data tables smoothly, ensuring system stability. Detail Use AWS CDK to create the file lib/dynamodb-gsi-stack.ts import * as cdk from "aws-cdk-lib" import * as dynamodb from "aws-cdk-lib/aws-dynamodb" import { Construct } from "constructs" export class DynamoDbGsiStack extends cdk . Stack { constructor ( scope : Construct , id : string , props ?: cdk . StackProps ) { super (scope, id, props) ...