thanks @yariplus I think I now see how can I achieve it:
I will have to create 3 sets in addition to the existing "main" object:
- one with a key like:
reputationLog:voter:{userId}
- one with a key like:
reputationLog:author:{authorId}
- one with a key like:
reputationLog:thread:{threadId}
This way when I want to find all votes in a thread, I can query against the last set.
If I want to retrieve all votes given to a certain user (author) then I would query the second set, and so on.
Inside each set I would store all the information needed to finally create the "full" query (user, author, thread and post):
reputationLog:{userId}:{authorId}:{threadId}:{postId}
It is a bit messy, and sets would contain duplicated information. Also when a vote changes the data must be updated in all sets and also the "main" object.
It's a pity I can't use MongoDB's full potential, that would have been much much easier!
thanks again, I will try this later.