Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
interface Deno.KvListOptions

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


limit: number

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

cursor: string

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

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.

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.

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.