Skip to content






API Explorer


Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

MongoDB connections

Martini features MongoDB support. This support includes easy to use connection pools (which is described on this page), the ability to perform queries against your MongoDB collections, and fully integrated Gloop steps that seamlessly perform MongoDB operations in your Gloop services.

MongoDB is an open-source NoSQL database that stores data using JSON-like documents. It is a popular choice for applications dealing with big data.

MongoDB configuration form

The properties below are used to configure MongoDB connections. Martini will use the configuration when connecting to the target MongoDB instance.

General configuration properties

Property Default Description
Name The name of the database.
Connection String mongodb://localhost:27017 Describes the hosts and options to be used when connecting to a MongoDB server. Hosts defined in the connection string are overridden if there is a host defined on Cluster Settings hosts.
Username The username to use when authenticating a connection.
Password The password to use when authenticating a connection.
Authentication Database The database containing the user. See reference.
Authentication Mechanism AUTO The mechanism to be used when authenticating using the credentials. See reference.
Auto Start true Whether or not to automatically start the database connection upon instance startup.
Authentication database

If the authentication database is not specified, it selects the value according to the following rules:

  • If a username is not provided, authentication is skipped;
  • If a database name is specified in the connection string, it is used as the authentication database;
  • Otherwise, 'admin' is used.

Using mongodb+srv scheme is unsupported

DNS seedlist connection format was introduced in MongoDB 3.6 to eliminate the need for clients to list each node of a MongoDB cluster in the connection string. Using this format is currently unsupported due to driver limitations.

Cluster configuration properties

Settings for cluster connections.

Property Default Description
Hosts (Required if Connection String is empty) The hosts for the cluster. Each host is added as a domain
Type Unknown The type of cluster to connect to.
Local Threshold (ms) 15 This defines the size of the latency window for selecting among multiple suitable servers.
Server Selection Timeout (ms) 30000 This is the timeout when selecting a server. A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.
Maximum Wait Queue Size 500 The number of threads that are allowed to be waiting for a connection.
Multiple cluster hosts

You can add multiple hosts under the Hosts field. Each host is a pairing of a domain and a port. You can even enter multiple comma-separated hosts when being asked for an entry, like so:


This configuration will use two hosts:

  • mongodb0.example:27017; and
  • mongodb1.example:27017

Adding multiple hosts using comma-separated

Connection configuration properties

Settings for the connection.

Property Default Description
Maintenance Frequency (ms) 60000 This is the time period between runs of the maintenance job.
Maintenance Initial Delay (ms) 0 The period of time to wait before running the first maintenance job on the connection pool.
Max Connection Idle Time (ms) 0 The maximum idle time of a pooled connection. A zero value indicates no limit to the idle time. A pooled connection that has exceeded its idle time will be closed and replaced when necessary by a new connection.
Max Connection Life Time (ms) 0 The maximum time a pooled connection can live for. A zero value indicates no limit to the life time. A pooled connection that has exceeded its life time will be closed and replaced when necessary by a new connection.
Max Wait Time (ms) 1200000 The maximum time that a thread may wait for a connection to become available. A value of 0 means that it will not wait. A negative value means it will wait indefinitely.
Max Wait Queue Size 500 This is the maximum number of operations that may be waiting for a connection to become available from the pool. All further operations will get an exception immediately.
Minimum Size 0 The minimum number of connections. Those connections will be kept in the pool when idle, and the pool will ensure that it contains at least this minimum number.
Max Size 100 The maximum number of connections allowed. Those connections will be kept in the pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.

Server configuration properties

Settings for server connections.

Property Default Description
Heartbeat Frequency (ms) 10000 The frequency that the cluster monitor attempts to reach each server.
Max Heartbeat Frequency (ms) 500 The minimum heartbeat frequency. In the event that the driver has to frequently re-check a server's availability, it will wait at least this long since the previous check to avoid wasted effort.

Socket configuration properties

Settings for socket connections.

Property Default Description
Connect Timeout (ms) 10000 The timeout for the socket to connect.
Read Timeout (ms) 0 The timeout for socket reads.
Receive Buffer Size 0 The size of the buffer when receiving from the socket.
Send Buffer Size 0 The size of the buffer when sending to the socket.