Method: Mongoid::Contextual::Mongo#third

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

#thirdDocument | nil

Get the third document in the database for the criteria’s selector.

Examples:

Get the third document.

context.third

Returns:

  • (Document | nil)

    The third document or nil if none is found.



642
643
644
# File 'lib/mongoid/contextual/mongo.rb', line 642

def third
  retrieve_nth(2)
end