Method: Mongoid::Contextual::Memory#first!

Defined in:
lib/mongoid/contextual/memory.rb

#first!Document

Get the first document in the database for the criteria’s selector or raise an error if none is found.

Examples:

Get the first document.

context.first!

Returns:

Raises:



163
164
165
# File 'lib/mongoid/contextual/memory.rb', line 163

def first!
  first || raise_document_not_found_error
end