Jeff Tsui
Jeff Tsui

Reputation: 1276

Mongoid timestamp indexing

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

Upvotes: 0

Views: 365

Answers (1)

a14m
a14m

Reputation: 8055

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

Upvotes: 1

Related Questions