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(s).",
"format": "string",
"minLength": 1,
"examples": [
"yourCluster-xxxyzzz.mongodb.net",
"localhost:27017,localhost:27018,localhost:27019"
]
},
"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"
]
},
"protocol": {
"title": "Protocol",
"type": "string",
"description": "The protocol to use for the MongoDB connection. Default is 'mongodb+srv'.",
"enum": [
"mongodb",
"mongodb+srv"
],
"default": "mongodb+srv",
"examples": [
"mongodb+srv"
]
},
"options": {
"title": "Options",
"type": "object",
"description": "Additional options for the MongoDB connection.",
"additionalProperties": true,
"default": {
"retryWrites": true,
"w": "majority"
},
"examples": [
{
"retryWrites": true,
"w": "majority",
"rs": "replicaSet"
}
]
}
},
"type": "object",
"additionalProperties": true,
"required": [
"clusterHostname",
"username",
"password"
]
}