Node-redis: Calling mget with an empty array of keys throws an error

Created on 8 Aug 2011  ·  4Comments  ·  Source: NodeRedis/node-redis

as in redis.mget([ ], mycallback).

I get the error: "Error: ERR wrong number of arguments for 'mget' command"

Most helpful comment

I expect mget(keys) to behave like map(keys, get) conceptually ([] => []).

All 4 comments

Here is an example of mget, does this solve the issue?

client.mget(["sessions started", "sessions started", "foo"], function (err, res) {
    console.dir(res);
});

I'm getting the same error as OP (wrong number of args...) for mget([ ]); how was this resolved?

Having zero-length input array is no special case IMO, it makes client code logic unnecessarily ugly.

Using redis-2.4.17 + node-redis v0.8.1.

@piskvorky What kind of behaviour are you expecting when calling mget([])?

I expect mget(keys) to behave like map(keys, get) conceptually ([] => []).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

strumwolf picture strumwolf  ·  4Comments

aletorrado picture aletorrado  ·  6Comments

betimer picture betimer  ·  5Comments

twappworld picture twappworld  ·  7Comments

shmendo picture shmendo  ·  6Comments