Question

Are mongoid timestamps automatically indexed or do they need to be explicitly indexed? If the latter, how do I index the automatically generated timestamp fields?

http://mongoid.org/en/mongoid/docs/extras.html#timestamps

Was it helpful?

Solution

as far as i know the timestaps are not auto indexed...

to index any field add this to the model

index({ created_at: 1 },{ background: true })

then you can create the added indexes using the following command

rake db:mongoid:create_indexes
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top