class User
include Mongoid::Document
has_many :foos
end
class Foo
include Mongoid::Document
include Mongoid::Timestamps
field :group_id, type:String
belongs_to :user
end
每个Foo属于具有group_id的组。但是,没有组模型。
为每个group_id获取单个最新(最高created_at)Foo的有效方法是什么?