I’m trying to use zadd function in redis its throws like an error.
zadd function not found in redis.
import { createClient } from 'redis';
const client = createClient({
host: 'localhost',
port: 32768,
});
client.connect().then(() => {
console.log('connected');
}).catch((err) => {
console.log('error', err);
});
client.set('foo', 'no');
client.get('foo', (err, result) => {
console.log(result);
}).then((result) => {
console.log(result);
});
client.zadd('myzset', 1, 'one'); // client.zadd is not a function
2
Answers
This works for me,
Node Redis 4.x introduced several breaking changes including support for Promises. All of the commands were also changed to be either camel-cased or uppercased.
Try this:
Or this:
You can find the information about this near the top of the README for Node Redis.