Skip to content

While select provides high-level abstraction, the query builder (available via db.query) offers more direct control over DynamoDB’s Query and Scan operations.

import { db } from "./db";
import { users } from "./schema";
import { eq } from "@aurios/mizzle";
const results = await db
.query(users)
.where(eq(users.id, "123"))
.limit(10)
.sort(false) // Descending
.execute();

Initializes the query builder for a specific entity.

  • Arguments:
    • entity: A Mizzle entity definition.
  • Returns: DynamoQueryBuilder

Sets the condition for the query.

  • Arguments:
    • condition: A Mizzle expression.
  • Returns: this

Sets the maximum number of items to evaluate.

  • Arguments:
    • val: Number of items.
  • Returns: this

Specifies the order of index traversal.

  • Arguments:
    • forward: true for ascending (default), false for descending.
  • Returns: this

Specifies a Global Secondary Index (GSI) to use for the query.

  • Arguments:
    • name: The name of the GSI.
  • Returns: this

Specifies which attributes to return.

  • Arguments:
    • cols: An array of column names.
  • Returns: this

Executes the operation (Query if PK is provided, otherwise Scan).

  • Returns: Promise<T[]>