Skip to main content

Config for mongodb

Jobs that use the mongodb adaptor may require authentication. A "credential" for the mongodb adaptor will follow the schema below. When using the CLI, you can set up your own state.configuration by using the sample below.

Sample Configuration

Paste this into the configuration key of your state.json file and modify the values to run jobs locally.

{
"clusterHostname": "yourCluster-xxxyzzz.mongodb.net",
"username": "admin",
"password": "@secret(!)Pass"
}

Full Schema

The full configuration schema describes each attribute of the credential and notes those that are required.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"clusterHostname": {
"title": "Cluster Hostname",
"type": "string",
"description": "Your MongoDB cluster hostname",
"format": "string",
"minLength": 1,
"examples": [
"yourCluster-xxxyzzz.mongodb.net"
]
},
"username": {
"title": "Username",
"type": "string",
"description": "Your MongoDB instance username",
"minLength": 1,
"examples": [
"admin"
]
},
"password": {
"title": "Password",
"type": "string",
"description": "Your MongoDB instance password",
"writeOnly": true,
"minLength": 1,
"examples": [
"@secret(!)Pass"
]
}
},
"type": "object",
"additionalProperties": true,
"required": [
"clusterHostname",
"username",
"password"
]
}