HDEL, HSET not working in NodeJS

15,350

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);
Share:
15,350
Arjun Bajaj
Author by

Arjun Bajaj

I'm the Co-Founder of HeadOn Labs.

Updated on June 09, 2022

Comments

  • Arjun Bajaj
    Arjun Bajaj almost 2 years

    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.

  • Arjun Bajaj
    Arjun Bajaj over 11 years
    Although I figured it out just before u answered, thanks for clarifying the methods. :D