Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的应用程序中使用 Ruby on rails,mongoid。我想获得集合中的最后一条记录。我试试
Person.find().sort({'_id',-1})
但是,此命令不适用于 ruby。我怎样才能获得最后的记录?提前致谢。
尝试这个
Person.asc(:created_at).last