Method: Mongoid::Findable#last

Defined in:
lib/mongoid/findable.rb

#last(limit = nil) ⇒ Document

Find the last Document given the conditions.

Examples:

Find the last document.

Person.last

Parameters:

  • limit (Integer) (defaults to: nil)

    The number of documents to return.

Returns:

  • (Document)

    The last matching document.



269
270
271
# File 'lib/mongoid/findable.rb', line 269

def last(limit = nil)
  with_default_scope.last(limit)
end