MongoDB (version 2.2 and higher) actually has a special index type that allows you to specify TTL in the document (see http://docs.mongodb.org/manual/tutorial/expire-data/ ). The database deletes expired documents for you - there is no need to complete cron jobs or anything else.
Mongoid supports this function as follows:
index({created_at: 1}, {expire_after_seconds: 1.week})
created_at /. Mongoid::Timestamps , .
UPDATE:
, /, . . :
field :expirable_created_at, type: Time
index({expirable_created_at: 1}, {expire_after_seconds: 1.week})
before_create :set_expire, if: "role == :guest"
def set_expire
self.expirable_created_at = Time.now
return true
end