Module: RocketJob::Plugins::Document::ClassMethods

Defined in:
lib/rocket_job/plugins/document.rb

Overview

rubocop:disable Style/RedundantSort

Instance Method Summary collapse

Instance Method Details

#firstObject

Mongoid does not apply ordering, add sort



17
18
19
# File 'lib/rocket_job/plugins/document.rb', line 17

def first
  all.sort("_id" => 1).first
end

#lastObject

Mongoid does not apply ordering, add sort



22
23
24
# File 'lib/rocket_job/plugins/document.rb', line 22

def last
  all.sort("_id" => -1).first
end