Frage

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

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top