开发者

Indices and capped collections with MongoMapper

开发者 https://www.devze.com 2023-01-20 17:28 出处:网络
What is the best way to set up an index or configure a capped collections in a Rails project开发者_开发百科?

What is the best way to set up an index or configure a capped collections in a Rails project开发者_开发百科?

From what I've found, it seems that a good way would be to keep this configuration in an initializer.

The command for setting up an index is ModelName.ensure_index :key, but what is the command for a capped collection?


Just drop down to the ruby driver to create the collection.

http://api.mongodb.org/ruby/1.0.7/Mongo/DB.html#create_collection-instance_method

Foo.database.create_collection(:foo, :capped => true)

Do that in an initializer or something.

0

精彩评论

暂无评论...
验证码 换一张
取 消