Skip to main content

Documentation Index

Fetch the complete documentation index at: https://upstash.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Arguments

key
string
required
The key of the hash.
count
integer
Optionally return more than one field.
withValues
boolean
Return the values of the fields as well.

Response

An object containing the fields and their values.
await redis.hset("key", {
  id: 1,
  username: "chronark",
  name: "andreas"
 });
const randomField = await redis.hrandfield("key");
console.log(randomField); // one of "id", "username" or  "name"