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.
我在 mongoDB 中找到了一些信息来完成此操作,但我需要使用 mongoid。所以我可以做类似的事情:
User.last(7000).each do ....
User.last(7000).each do ...
我正在使用:
MongoDB 外壳版本:2.4.3
Mongoid 2.6.0
谢谢!
现在我从 mongoid origin找到了一个解决方案:
User.all.desc('_id').limit(7000)
它根据 id 对用户进行降序排序。