-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
Hi,
I'm using Mongoid 3.1.4 with Rails 3.2.13, and TTL indexes don't seem to work.
Here is an example :
[1] pry(main)> class Toto [1] pry(main)* include Mongoid::Document [1] pry(main)* field :foo, type: Integer [1] pry(main)* index({ foo: 1 }, { expire_after_seconds: 20 }) [1] pry(main)* end => {:expireAfterSeconds=>20} [2] pry(main)> Toto.new(foo: 42).save => true [3] pry(main)> Time.now => 2013-07-22 18:28:59 +0400 [4] pry(main)> Toto.count => 1 [5] pry(main)> Toto.last => #<Toto _id: 51ed41a85ce9fd0bfc000001, foo: 42> [6] pry(main)> Time.now => 2013-07-22 18:34:24 +0400 [7] pry(main)>
Someone else seems to be experiencing the same issue : http://www.blogosfera.co.uk/2013/07/mongoid-ttl-option-doesnt-work/