Method: Mongoid::Findable#first

Defined in:
lib/mongoid/findable.rb

#firstDocument Also known as: one

Find the first Document given the conditions.

Examples:

Find the first document.

Person.first

Returns:

  • (Document)

    The first matching document.

Since:

  • 4.0.0



146
147
148
# File 'lib/mongoid/findable.rb', line 146

def first
  with_default_scope.first
end