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.
The properties below are used to configure MongoDB connections. Martini will use the configuration when connecting to the target MongoDB instance.
General configuration properties
|Name||The name of the database.|
||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.|
||The mechanism to be used when authenticating using the credentials. See reference.|
||Whether or not to automatically start the database connection upon instance startup.|
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.
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.
|Hosts||(Required if Connection String is empty)||The hosts for the cluster. Each host is added as a domain|
||The type of cluster to connect to.|
|Local Threshold (ms)||
||This defines the size of the latency window for selecting among multiple suitable servers.|
|Server Selection Timeout (ms)||
||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||
||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:
Connection configuration properties
Settings for the connection.
|Maintenance Frequency (ms)||
||This is the time period between runs of the maintenance job.|
|Maintenance Initial Delay (ms)||
||The period of time to wait before running the first maintenance job on the connection pool.|
|Max Connection Idle Time (ms)||
||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)||
||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)||
||The maximum time that a thread may wait for a connection to become available. A value of
|Max Wait Queue Size||
||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.|
||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.|
||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.
|Heartbeat Frequency (ms)||
||The frequency that the cluster monitor attempts to reach each server.|
|Max Heartbeat Frequency (ms)||
||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.
|Connect Timeout (ms)||
||The timeout for the socket to connect.|
|Read Timeout (ms)||
||The timeout for socket reads.|
|Receive Buffer Size||
||The size of the buffer when receiving from the socket.|
|Send Buffer Size||
||The size of the buffer when sending to the socket.|