Mongoid includes ActiveModel::Validations to supply the basic validation plus an additional associated and uniqueness validator.

See the Active Record Validations Rails guide and ActiveModel::Validations documentation for more information.

Mongoid behaves slightly differently to Active Record when using #valid? on already persisted data. Active Record’s #valid? will run all validations whereas Mongoid’s #valid? will only run validations on documents that are in memory as an optimization.