class Mongoid::Giza::ID
MongoDB counter collection to generate ids compatible with sphinx
Public Class Methods
next(klass)
click to toggle source
Gets the next id in the sequence to assign to an object
@param klass [Symbol] the name of the class which next id will be
retrived for
@return [Integer] the next id in the sequence
# File lib/mongoid/giza/models/id.rb, line 17 def next(klass) giza_id = where(id: klass).find_and_modify({"$inc" => {seq: 1}}, new: true) giza_id.seq end