Module Mongoid::Criterion::Creational
In: lib/mongoid/criterion/creational.rb

This module defines criteria behavior for creating documents in the database for specified conditions.

Methods

create  

Public Instance methods

Create a document in the database given the selector and return it. Complex criteria, such as $in and $or operations will get ignored.

@example Create the document.

  Person.where(:title => "Sir").create

@example Create with selectors getting ignored.

  Person.where(:age.gt => 5).create

@return [ Document ] A newly created document.

@since 2.0.0.rc.1

[Validate]