Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
method Deno.Kv.prototype.get

Retrieve the value and versionstamp for the given key from the database in the form of a Deno.KvEntryMaybe. If no value exists for the key, the returned entry will have a null value and versionstamp.

const db = await Deno.openKv();
const result = await db.get(["foo"]);
result.key; // ["foo"]
result.value; // "bar"
result.versionstamp; // "00000000000000010000"

The consistency option can be used to specify the consistency level for the read 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.

Type Parameters

optional
T = unknown

Parameters

key: KvKey
optional
options: { consistency?: KvConsistencyLevel; }