(Edited original issue)
Currently, has_many :models, :dependent => :nullify keeps the ID intact for its associated models. For example:
class User include Mongoid::Document has_many :comments # currently I need to do this, otherwise comment.user points to a deleted user ID before_destroy :orphan_comments protected def orphan_comments self.comments.each do |c| c.user = nil c.save end end end
This is a pain when I want to write something like Comment.where(user: nil).
I'd propose to either auto-delete the associated model ID, or maybe provide a :dependent => :orphan feature which does this.
Using mongoid 3.0.17