Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HDEL, HSET not working in NodeJS

can anyone tell me what is wrong in this code?

redis.hdel("hash:" + id + " key" function(err, success) {
    console.log("Hash Deleted");
});

Is there any other way to do it?

And I'm also struggling with HSET:

redis.hset("hash:" + id + " key", "true");

It tells me "wrong number of arguments". What more is it expecting? In the Redis documentation of HSET, there are no more parameters.

So I used HMSET instead, and it works properly. :)

Also, if anyone can tell me, some source where I can find examples of all commands or at least all the hash commands in NodeJS.

Thanks.

like image 290
Arjun Bajaj Avatar asked Sep 06 '12 01:09

Arjun Bajaj


1 Answers

HSET takes three parameters, key, field, value. HDEL takes two, key and field. Have you tried, as per the readme:

client.hset("key", "field", "value", callback);

Similarly,

client.hdel("key", "field", callback);
like image 79
Michelle Tilley Avatar answered Sep 28 '22 08:09

Michelle Tilley