MongoDB in the properties.json
  • 01 Apr 2024
  • Dark
    Light
  • PDF

MongoDB in the properties.json

  • Dark
    Light
  • PDF

Article summary

MongoDB Properties

The MongoDB properties in the properties.json must be configured to connect to a single MongoDB server or a MongoDB replica set. Be sure to align your authentication and encryption settings with the configurations of the MongoDB you are connecting to.

Starting with the 2023.2 release, the ssl properties are deprecated and replaced with tls. See the Deprecation Notice here.

Property Name Type Default Description
db String pronghorn The name of the database to connect to.
url String mongodb://localhost:27017 The MongoDB URL to use when connecting to the database. IPv6 addresses are supported with brackets enclosing the host (e.g.,
mongodb://[::1]:27017).
maxPoolSize Integer 100 A number that represents the maximum number of connections allowed within a connection pool. Valid values range from 1 to 65535.
credentials.dbAuth Boolean false A boolean flag indicating whether user authentication is enabled.
credentials.dbAuthSource String The user provided db property value. Specify the database name associated with the user’s credentials. Corresponds to authSource in MongoDB connection options.
credentials.user String The username to use for connections when authentication is enabled.
credentials.passwd String The password to use for connections when authentication is enabled.
credentials.user String The username to use for connections when authentication is enabled.
credentials.passwd String The password to use for connections when authentication is enabled.
ssl.enabled Boolean false A boolean flag indicating whether SSL is enabled. IAP 2022.1 & 2023.1 Only
ssl.sslValidate Boolean false A boolean flag indicating whether the MongoDB server's certificate will be validated. IAP 2022.1 & 2023.1 Only
ssl.sslCA String Path to the certificate authority PEM (privacy enhanced mail) file that signed the MongoDB certificates. IAP 2022.1 & 2023.1 Only
ssl.acceptInvalidCerts Boolean IAP 2022.1 & 2023.1 Only
ssl.checkServerIdentity Boolean A boolean flag indicating whether to validate the name of the server configured in the URL against the common name of the certificate the server presents. IAP 2022.1 & 2023.1 Only
tls.enabled Boolean false A boolean flag indicating whether SSL is enabled. IAP 2023.2 Only
tls.CAFile String Path to the certificate authority PEM (privacy enhanced mail) file that signed the MongoDB certificates. IAP 2023.2 ONLY
tls.AllowInvalidCerts Boolean A boolean flag indicating whether to validate the MongoDB certificate against the certificate authority PEM file.** IAP 2023.2 Only **

Minimal MongoDB Configuration

"mongoProps": {
  "db": "pronghorn",
  "url": "mongodb://localhost:27017"
}

Sample Production Configuration

"mongoProps": {
  "db": "pronghorn",
  "url": "mongodb://mongo01:27017,mongo02:27017,mongo03:27017?rs=rs1",
  "credentials": {
    "dbAuth": true,
    "user": "pronghorn",
    "passwd": "$ENC93f88824437dfe5784c7570f99d7251f878a2284aed6449259"
  },
  "tls": {
    "enabled": true,
    "tlsCAFile": "/etc/ssl/keys/mongo_ca_chain.cert",
    "tlsAllowInvalidCerts": false,
  }
}
Note:

Refer to the MongoDB guide for more detail on installing MongoDB with IAP.

Connection Pool Size in MongoDB

Connection pooling allows you to reuse connections rather than creating a new one every time IAP needs to establish a connection to the Mongo database. To configure the connection pool when connecting to MongoDB, use the maxPoolSize setting under mongoProps within the properties.json file.

This setting limits the ability of each application or adapter to add connections to the connection pool. In other words, it regulates (limits) the maximum number of pooled connections that can be opened for every application and adapter. When the maximum number of connections is reached, no additional connections can be created (opened) in the connection pool. Modification of maxPoolSize should be done with careful testing, as any changes to this value can impact IAP and workflow performance.

⚠ Warning

We recommend the default value for this setting as very low values can significantly affect platform performance. Please exercise caution if you elect to lower the default value. If degradation is observed, restore it to the default.

Property Name Type Default Description
maxPoolSize Integer 10 A number that represents the maximum number of connections allowed within a connection pool. Valid values range from 1 to 65535.

Sample Connection Pool Configuration

"mongoProps": {
  "db": "pronghorn",
  "url": "mongodb://localhost:27017",
  "maxPoolSize": 10
}

For more information on connection pooling, refer to:


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.