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

abhaygarg picture abhaygarg  路  5Comments

adamgajzlerowicz picture adamgajzlerowicz  路  4Comments

Atala picture Atala  路  3Comments

Mickael-van-der-Beek picture Mickael-van-der-Beek  路  6Comments

aletorrado picture aletorrado  路  6Comments