Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.unstable.d.ts>Deno.KvListOptions

A modern runtime for JavaScript and TypeScript.
Latest
interface Deno.KvListOptions
import { type Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.unstable.d.ts";
const { KvListOptions } = Deno;

UNSTABLE: New API, yet to be vetted.

Options for listing key-value pairs in a Deno.Kv.

Properties

optional
limit: number

The maximum number of key-value pairs to return. If not specified, all matching key-value pairs will be returned.

optional
cursor: string

The cursor to resume the iteration from. If not specified, the iteration will start from the beginning.

optional
reverse: boolean

Whether to reverse the order of the returned key-value pairs. If not specified, the order will be ascending from the start of the range as per the lexicographical ordering of the keys. If true, the order will be descending from the end of the range.

The default value is false.

optional
consistency: KvConsistencyLevel

The consistency level of the list operation. The default consistency level is "strong". Some use cases can benefit from using a weaker consistency level. For more information on consistency levels, see the documentation for Deno.KvConsistencyLevel.

List operations are performed in batches (in sizes specified by the batchSize option). The consistency level of the list operation is applied to each batch individually. This means that while each batch is guaranteed to be consistent within itself, the entire list operation may not be consistent across batches because a mutation may be applied to a key-value pair between batches, in a batch that has already been returned by the list operation.

optional
batchSize: number

The size of the batches in which the list operation is performed. Larger or smaller batch sizes may positively or negatively affect the performance of a list operation depending on the specific use case and iteration behavior. Slow iterating queries may benefit from using a smaller batch size for increased overall consistency, while fast iterating queries may benefit from using a larger batch size for better performance.

The default batch size is equal to the limit option, or 100 if this is unset. The maximum value for this option is 500. Larger values will be clamped.