I have started using Redis Stack recently with dotnet. I am however having issues to figure how to achieve the following aggregation.
I have a list of sport events, each of them, among other properties, has SportCode
and Status
. I am trying to group my entities in a way I can get the following result:
[
"sport": "SOCCER",
"eventsCount": 400,
"liveEventsCount": 12
]
So far I've tried 2 approaches:
- Use
RedisAggregationSet<TEntity>
- this gives me the groups, but I did not see a way to get count of total items per group or count of items that match a condition (to get the live events) - Use
IRedisCollection<TEntity>
- grouping here always throws a JSON serialization error, even after I've changed all my records in Redis to be saves as hash, instead of json.