StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.88k stars 1.51k forks source link

SortedSetRangeByValueAsync method returns incorrect results when filtering by value range #2735

Open devbaran opened 4 months ago

devbaran commented 4 months ago

I am experiencing an issue with the SortedSetRangeByValueAsync method in the StackExchange.Redis library. The method seems to return incorrect results when filtering by a specific value range.

StackExchange.Redis version: 2.7.33 .NET version: 7 Redis server version: 6.2.11

var min = "[67aacca2-04ba-425b-bca3-fdaf074cd04e";
var max = "(67aacca2-04ba-425b-bca3-fdaf074cd04e";
var results = await database.SortedSetRangeByValueAsync("UserConnectionIds", min, max);

foreach (var result in results)
{
    Console.WriteLine(result);
}

Expected Result: Only the elements within the specified range (those starting with "67aacca2-04ba-425b-bca3-fdaf074cd04e") should be returned.

Actual Result: The method returns elements outside the specified range, including GUIDs starting with "3fa", which should not be included based on the provided range.

Is there a specific way to format the min and max parameters for the SortedSetRangeByValueAsync method? Are there any known issues or limitations with using this method for filtering by value ranges?