DynamoDB: Like (Guide w/ Code Examples)

Provided by Rafal Wilinski
Last updated: October 23rd, 2026
DynamoDB has no SQL LIKE operator. Use begins_with for a key prefix, or contains in a filter for a substring match on items already selected by a Query.
Install @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb, use an ES module on a supported Node.js runtime, and configure an AWS Region and credentials. The examples use an existing Orders table with String keys pk and sk unless an index or timestamp key is described.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; import { DynamoDBDocumentClient, QueryCommand } from "@aws-sdk/lib-dynamodb"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); let lastKey; do { const page = await ddb.send(new QueryCommand({ TableName: "Orders", KeyConditionExpression: "#pk = :pk", FilterExpression: "contains(#name, :term)", ExpressionAttributeNames: { "#pk": "pk", "#name": "name" }, ExpressionAttributeValues: { ":pk": "CUSTOMER#123", ":term": "bike" }, ExclusiveStartKey: lastKey, })); for (const item of page.Items ?? []) console.log(item); lastKey = page.LastEvaluatedKey; } while (lastKey && Object.keys(lastKey).length > 0);
String matching is case-sensitive. The filter saves response bandwidth, not read capacity. For full-text or wildcard search at scale, use a search index.
Reference: AWS Query API. For related access patterns, see DynamoDB query examples.
Similar Code Examples
- DynamoDB: Query KeyConditionExpression
- DynamoDB: Get By ID
- DynamoDB: Attribute Not Null
- DynamoDB Get in Typescript
- DynamoDB: Query Ends With
- DynamoDB: Query Count
- DynamoDB: Increment Counter
- DynamoDB BatchWriteItem in Typescript
- DynamoDB: Bulk Insert
- DynamoDB: Get Last Inserted Item
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: BatchGetItem
- DynamoDB: Query JSON
- DynamoDB: Get Last 10 Records
- DynamoDB: Delete All Items With Partition Key
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable
DynamoDB Info
© 2026 Dynobase