node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Calling mget with an empty array of keys throws an error

Open gpascale opened this issue 15 years ago • 4 comments

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

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

gpascale avatar Aug 08 '11 00:08 gpascale

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

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

DTrejo avatar Apr 28 '12 03:04 DTrejo

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 avatar Sep 28 '12 18:09 piskvorky

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

skenqbx avatar Sep 28 '12 19:09 skenqbx

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

piskvorky avatar Sep 28 '12 20:09 piskvorky