Hash

HINCRBY

Increments the value of a hash field by a given amount

Arguments

keybodystringrequired

The key of the hash.

fieldbodystringrequired

The field to increment

incrementbodyintegerrequired

How much to increment the field by. Can be negative to subtract.

Response

integerrequired

The new value of the field after the increment.

Example
await redis.hset("key", {  field: 20,  });const after = await redis.hincrby("key", "field", 2);console.log(after); // 22
Loading search…