devvit icon indicating copy to clipboard operation
devvit copied to clipboard

Redis zRange by lex does not behave like docs suggest`

Open devvit-help-bot[bot] opened this issue 1 year ago • 0 comments

Details

Example gist: https://gist.github.com/fsvreddit/382476dcf4f1efe470dfb146a93a7e4d

by: lex appears to be taking the input as-is and prepending a [ to start/end unless the value is one of the special values - or +.

I should be able to work around this behaviour by deliberately manipulating the strings I put in.

Additional info

Discord message: _I don't think that zRange by lex is working quite like the official Redis documentation says it should. Imagine a sorted set with members a, b, c, d and e.

const res = await context.redis.zRange("myKey", "[b", "[d", { by: "lex" }); should return ["b", "c", "d"] because the [ indicates an inclusive range, and const res = await context.redis.zRange("myKey", "(b", "(e", { by: "lex" }); should return just ["c"] because ( indicates exclusive. However in both cases I just get an empty array.

If I omit the ( or [, I get b, c and d however. This implies to me some processing is happening on the server rather than the inputs being taken as-is._

Message author: big.wheel

Discord link: https://discord.com/channels/1050224141732687912/1242689538447507458/1287404638345367612

devvit-help-bot[bot] avatar Sep 23 '24 14:09 devvit-help-bot[bot]