开发者

Indices and capped collections with MongoMapper

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜