Navigation

Collection Configuration

Capped Collections

Mongoid does not provide a mechanism for creating capped collections on the fly - you will need to create these yourself one time up front either with the driver or via the Mongo console.

To create a capped collection with the driver:

client["name", :capped => true, :size => 1024].create

To create a capped collection from the Mongo console:

db.createCollection("name", { capped: true, size: 1024 });

Set a Default Collation on a Collection

Mongoid does not provide a mechanism for creating a collection with a default collation. Like capped collections, you will need to create the collection yourself one time, up-front, either with the driver or via the Mongo console.

To create a collection with a default collation with the driver:

client["name", :collation => { :locale => 'fr'}].create

To create a collection with a default collation from the Mongo console:

db.createCollection("name", { collation: { locale: 'fr' } });