1

I have this line in node.js, but i get wrong number of arguments. In redis-cli it would be easy, etg test 10 2, but for some reason it wont work here.

example:

convensation:convensationIds:user:23984 294874 1

my code:

 redis_client.zadd(['convensation:convensationIds:user:' + data.from ,convensationId ,data.to]);

error:

RR wrong number of arguments for 'zadd' command

EDIT:

i also tried

redis_client.zadd('convensation:convensationIds:user:' + data.from ,convensationId ,data.to);

but got the same error as above.

2 Answers 2

2

You're passing just one argument, namely an array. Try passing the values of that array as proper arguments:

redis_client.zadd('convensation:convensationIds:user:' + data.from ,convensationId ,data.to);
1
  • @maria which Redis library are you using? I can't reproduce using redis.
    – robertklep
    Jul 19, 2015 at 7:45
1

zadd takes three parameters:

  1. The first is the name of the Z set
  2. The second is number, most probably 0
  3. The third is new value

Example: client.zadd("job", 0 , string_job);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.