Creating databases and collections in MongoDB
A MongoDB connection requires at least one database and collection, as this is where it stores your data. To avoid having to use other tools outside of Martini to create databases and collections, Martini includes a wizard that creates them for you. This page will describe how to add a database and collection to a MongoDB connection (as well as adding a collection to an existing database).
- From the Database Navigator view (in the Database perspective), right click the MongoDB connection where you'll be adding the database and collection. Then select New > New MongoDB Collection.
- Select a database from the dropdown, or enter a new database name1. A new database will be created if the specified database does not exist yet.
- Enter a collection name2.
- Click the Finish button if you don't want to setup advanced configuration for your collection. Or alternatively click Next and configure the advanced settings for the new collection, then click Finish.
||The name of the MongoDB connection pool.|
||The name of the database.|
||The name of the collection to create.|
||To create a capped collection, specify
||The maximum number of documents allowed in the capped collection. The size limit takes precedence over this limit. If a capped collection reaches the size limit before it reaches the maximum number of documents, MongoDB removes old documents. If you prefer to use the max limit, ensure that the size limit, which is required for a capped collection, is sufficient to contain the maximum number of documents.|
|Size In Bytes||
||Specify a maximum size in bytes for a capped collection. Once a capped collection reaches its maximum size, MongoDB removes the older documents to make space for the new documents. This field is required for capped collections and ignored for other collections.|
||Determines how strictly MongoDB applies the validation rules to existing documents during an update.|
||Determines whether to error on invalid documents or just warn about the violations but allow invalid documents to be inserted.|
||Allows users to specify validation rules or expressions for the collection.|
Storage engine options
||Allows users to specify configuration to the storage engine on a per-collection basis when creating a collection.|
The storage engine configuration specified when creating collections is validated and logged to the oplog during replication to support replica sets with members that use different storage engines.
Index option defaults
||Allows users to specify a default configuration for indexes when creating a collection. It accepts a
The storage engine configuration specified when creating indexes are validated and logged to the oplog during replication to support replica sets with members that use different storage engines.
||The ICU locale.|
||Flag that determines whether to include case comparison at strength level 1 or 2.|
||A field that determines sort order of case differences during tertiary level comparisons.|
||The level of comparison to perform.|
||Flag that determines whether to compare numeric strings as numbers or as strings.|
||Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.|
||Field that determines up to which characters are considered ignorable when alternate is
||Flag that determines whether to check if text requires normalization and to perform normalization. Generally, the majority of text does not require this normalization processing.|
||Flag that determines whether strings with diacritics sort from the back of the string, such as with some French dictionary ordering.|
For more detailed information, go to official MongoDB documentation page.
See also Naming Restrictions. ↩
See also Restriction on Collection Names. ↩