mongoid/mongoid — comment on commit bfbf4ab2f64f38737d1f3ab2c835286e82017b4b
File:  line 0
By AartiKriplani:

Looks a good optimization except that it doesn't work in a case where uniqueness check is scoped. For example:

class Folder
#mongoid_document
#implements acts_as_tree
#unique name by parent scope (i.e. name should be unique for children)
end

When I don't change the name but change the parent; my scope has changed. Hence uniqueness validation should either hit db all the time Or should consider if scope has changed.