Scan
Command to scan entire table or index (expensive operation).
Example
Section titled “Example”import { DynamoTable, DynamoEntity, key, Scan } from 'dynamo-document-builder';
const table = new DynamoTable({ tableName: 'ExampleTable', documentClient,});
const todoEntity = new DynamoEntity({ table, schema: z.object({ userId: z.string(), todoId: z.string(), isComplete: z.boolean(), }), partitionKey: todo => key('USER', todo.userId), sortKey: todo => key('TODO', todo.todoId),});
const scanCommand = new Scan({ filter: { isComplete: false }, limit: 100,});
const { items, scannedCount } = await todoEntity.send(scanCommand);Type Parameters
Section titled “Type Parameters”Schema
Section titled “Schema”Schema extends ZodObject
The Zod schema defining the structure of the entity.
Implements
Section titled “Implements”BaseCommand<ScanResult<Schema>,Schema>BasePaginatable<ScanResult<Schema>,Schema>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Scan<Schema>(config?): Scan<Schema>;Parameters
Section titled “Parameters”config?
Section titled “config?”ScanConfig<Schema>
Returns
Section titled “Returns”Scan<Schema>
Methods
Section titled “Methods”buildCommandInput()
Section titled “buildCommandInput()”buildCommandInput(entity): ScanCommandInput;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Returns
Section titled “Returns”ScanCommandInput
buildResult()
Section titled “buildResult()”buildResult(items, scanResult): ScanResult<Schema>;Parameters
Section titled “Parameters”EntitySchema<Schema>[]
scanResult
Section titled “scanResult”ScanCommandOutput
Returns
Section titled “Returns”ScanResult<Schema>
execute()
Section titled “execute()”execute(entity): Promise<ScanResult<Schema>>;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Returns
Section titled “Returns”Promise<ScanResult<Schema>>
Implementation of
Section titled “Implementation of”executePaginated()
Section titled “executePaginated()”executePaginated(entity): AsyncGenerator<ScanResult<Schema>, void, unknown>;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Returns
Section titled “Returns”AsyncGenerator<ScanResult<Schema>, void, unknown>
Implementation of
Section titled “Implementation of”BasePaginatable.executePaginated
validateItems()
Section titled “validateItems()”validateItems(entity, items): Promise<EntitySchema<Schema>[]>;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Record<string, any>[] | undefined
Returns
Section titled “Returns”Promise<EntitySchema<Schema>[]>