await redis.hset("key", {
  id: 1,
  username: "chronark",
  name: "andreas"
  });
const fields = await redis.hmget("key", "username", "name");
console.log(fields); // { username: "chronark", name: "andreas" }

Arguments

key
string
required

The key of the hash.

fields
...string[]
required

One or more fields to get.

Response

An object containing the fields and their values.

await redis.hset("key", {
  id: 1,
  username: "chronark",
  name: "andreas"
  });
const fields = await redis.hmget("key", "username", "name");
console.log(fields); // { username: "chronark", name: "andreas" }