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.
Mongoid 支持软删除
include Mongoid::Paranoia
假设我已经从其中一个集合中软删除了一个文档。
现在我需要一个包含该集合中软删除文档的查询。
我怎样才能做到这一点?
我需要为此制定一个单独的方法吗?
谢谢
您可以通过查询找到所有已删除的文档
Model.deleted
如果您想查找具有特定条件的已删除文档,那么
Model.deleted.where(:field => value)