Hash
HMGET
Return the requested 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" }
Arguments
key
string
requiredThe key of the hash.
fields
...string[]
requiredOne or more fields to get.
Response
An object containing the fields and their values.
Was this page helpful?
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" }