redis hmset不是节点中的函数

rn0zuynd  于 2023-02-07  发布在  Redis
关注(0)|答案(1)|浏览(235)

我正在运行node.js 16和redis 5.0,当我尝试连接到redis时,我可以运行info之类的命令,但当我尝试运行hmset时,我收到一个错误,说它不是一个函数。

Welcome to Node.js v16.13.2.
Type ".help" for more information.
> const redis = require("redis");
undefined
> const client = redis.createClient();
undefined
> client.connect()
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 98,
  [Symbol(trigger_async_id_symbol)]: 5,
  [Symbol(destroyed)]: { destroyed: false }
}
> client.hmset("hi", "foo", "bar", "hello", "world");
Uncaught TypeError: client.hmset is not a function

请就如何解决这一问题提供指导。

mxg2im7a

mxg2im7a1#

尝试hset函数;它具有相同的功能。
Redis中的HMSET命令已弃用,取而代之的是HSET命令。

相关问题