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

Lists get condensed into a comma-separated string on retrieval

Open stickfigure opened this issue 13 years ago • 7 comments

Here's what I see in a node session:

logger = function(err, results) { console.log(JSON.stringify({err: err, results:results})); } [Function] r.rpush("abc", ["foo", "bar"], logger) true {"err":null,"results":1} r.lrange("abc", 0, -1, logger) true {"err":null,"results":["foo,bar"]}

Notice that results are ["foo, bar"] instead of ["foo", "bar"]. This seems like a bug of some sort - certainly not what I expected.

My package.json has: "redis": "0.8.x", "hiredis": "0.1.x",

stickfigure avatar Mar 03 '13 07:03 stickfigure

Hi @stickfigure Yes, right now there is no type-sniffing for these sorts of operations. See my comment here on a similar case: https://github.com/mranney/node_redis/issues/369#issuecomment-13050944

It seems a common enough desire to pass data like this but my gut feeling is there are potentially real performance issues with implementations. I'll work on something here.

brycebaril avatar Mar 03 '13 17:03 brycebaril

Thanks, I will use send_command directly for now. This really was a big surprise, and produced subtle hard-to-hunt-down behavior in my app. I'm sure a lot of people will stumble over the same problem. I'd rather have "safe" behavior than micro-optimized behavior; perhaps the speed demons can use send_command directly and the other apis can be more convenient?

Either way, thanks for maintaining this code.

stickfigure avatar Mar 03 '13 17:03 stickfigure

Also, it may be wise to add a caution about this issue to the documentation - it would probably save a lot of aggregate man-hours of debugging.

stickfigure avatar Mar 03 '13 17:03 stickfigure

yes, it took me one day to reach here.

disorderdev avatar Mar 16 '13 14:03 disorderdev

Spent a few hours tonight scratching my head over this---almost sent it to production without realizing what was happening. +1 to better documentation about this issue. Again, though, thank you for your work on the client.

vskarich avatar Mar 06 '15 07:03 vskarich

Not fixed => reopening

BridgeAR avatar Sep 13 '15 03:09 BridgeAR

This got closed by #838

BridgeAR avatar Sep 16 '15 03:09 BridgeAR