What I’m trying to do is find the users with the most posts. User and Post are Mongoid::Document
The ActiveRecord equivalent of User.group(posts) doesn’t work. I can access the number of posts a User has by @user.posts.count
How do I find the user with most posts, without sorting an array of all users by post count?
Mongoid collections respond to Array functions when you use :all.
That iterates through all the Users and finds the User with the most posts.