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

id0Sch picture id0Sch  路  4Comments

juriansluiman picture juriansluiman  路  3Comments

b96705008 picture b96705008  路  7Comments

ghost picture ghost  路  3Comments

aletorrado picture aletorrado  路  6Comments