I’ve got a fixed list of several thousand Things, and a User base that
may grow to who knows how big (we can only hope ,right?) Users have and
belong to many Things. I want to display a list of top Things, based on
how many users each has. Things with 0 users are not displayed.
Two questions. First, I expect the density of the relatioships to focus
on a small percentage of the things. So while I may have 10,000 of
them, it might be true that only 100 have at least 1 user. In doing my
find statements, what would the syntax be to say “I am only interested
in Things where users.size > 0”? I’m hoping that I odn’t have to get
them all and simply choose not to display 90% of them, that seems like
unnecessary moving around of data.
Second, my goal is to sort these Things for presentation by users.size()
descending. Can I push my luck and get that out of the initial find
statement, or do I have to do my own sort?