1
class Event
include Mongoid::Document
field :status, type: Integer
index({ status: 1 }, { expire_after_seconds: 3600 })
end
我知道MongoDB和Mongoid的TTL選項。 https://github.com/mongoid/mongoid/commit/ac3c4bbe43c8756daff844c808c99b84f10834bcmongoid TTL選項不起作用
但它的ttl選項不起作用,因爲我更新和升級紅寶石寶石和釀造包。 你有什麼建議嗎?
您正在使用哪個MongoDB版本? – Derick
現在我使用MongoDB 2.4.5。 – Bamboo
在服務器中,選項是expireAfterSeconds,而不是expire_after_seconds - 可以這樣嗎? – Derick