Skip to content

Home

Introduction

Development

IDEs

Services

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

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).

MongoDB Collection wizard

  1. 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.
  2. 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.
  3. Enter a collection name2.
  4. 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.

Properties

General settings

Name Required Description
Connection true The name of the MongoDB connection pool.
Database Name true The name of the database.
Collection Name true The name of the collection to create.

Advanced settings

Name Required Default value Description
Capped false false To create a capped collection, specify true. If you specify true, you must also set a maximum size in the size field.
Max Documents false 0 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 false 0 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.

Validation options

Name Required Default value Description
Validation Level false Strict Determines how strictly MongoDB applies the validation rules to existing documents during an update.
Validation Action false Error Determines whether to error on invalid documents or just warn about the violations but allow invalid documents to be inserted.
Validator false Text Allows users to specify validation rules or expressions for the collection.

Storage engine options

Name Required Default value Description
Source false Text 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

Name Required Default value Description
Source false Text Allows users to specify a default configuration for indexes when creating a collection. It accepts a storageEngine document.

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.

Collation settings

Name Required Default value Description
Locale false The ICU locale.
Case Level false false Flag that determines whether to include case comparison at strength level 1 or 2.
Case First false Off A field that determines sort order of case differences during tertiary level comparisons.
Strength false Tertiary The level of comparison to perform.
Numeric Ordering false false Flag that determines whether to compare numeric strings as numbers or as strings.
Alternate false Non-ignorable Field that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
Max Variable false Punct Field that determines up to which characters are considered ignorable when alternate: "shifted". Has no effect if alternate: "non-ignorable
Normalization false false Flag that determines whether to check if text require normalization and to perform normalization. Generally, majority of text does not require this normalization processing.
Backwards false false Flag that determines whether strings with diacritics sort from back of the string, such as with some French dictionary ordering.

For more detailed information, go to official MongoDB documentation page.