Add a Database Connector via the Settings UI
Open Settings
Navigate to Settings in the Devset UI (http://localhost:8082).
Select the Databases tab
Click the Databases tab. Any connectors you have already created are listed here.
Fill in the connector form
Click Add Connector and complete the fields for a MongoDB connection. See the field reference below.
MongoDB Connector Field Reference
Must be
"mongodb". This tells Devset which driver to use when establishing the connection.A unique identifier for this connector. Workflow query blocks reference this connector by setting
connection to this value. Use a descriptive slug such as local-mongo or prod-users-db.The MongoDB connection URI, for example
mongodb://localhost:27017. For Atlas or authenticated clusters, include credentials in the URI or use the username and password fields below.The default database to use when a query block does not specify one explicitly. If omitted, the query block must include a
database field.The username for authenticating with MongoDB. Leave blank if authentication is handled through the connection string or if the instance requires no credentials.
The password for the specified username. Leave blank when authentication is not required.
Use a Database Connector in a Workflow Query Block
After saving a connector, reference it inside a workflow stage’squery block by setting connection to the connector’s name. The query block fetches documents from MongoDB and maps fields into the workflow’s state, making the data available to subsequent stages.
Query Block Field Reference
The
name of the database connector to use for this query.The MongoDB database to query. Overrides the default database set on the connector. Required if no default database was configured on the connector.
The name of the MongoDB collection to query.
A MongoDB filter document. You can use the
$path operator to resolve values dynamically from the current workflow state. For example, { "$path": "state.entity.id" } substitutes the value of state.entity.id at query time.A mapping from source document field paths to state keys. Each key is a dot-notated path in the returned document; each value is the key under which that field is stored in the workflow state. For example,
{ "entity.name": "name" } reads entity.name from the document and stores it as name in the workflow state.The
find filter uses standard MongoDB query operators. The $path operator is a Devset-specific extension that lets you inject runtime state values into the filter before the query is sent to MongoDB.API Reference
You can manage database connectors programmatically using the Devset REST API.Create a Database Connector
List All Database Connectors
Delete a Database Connector
Replace{type} with mongodb and {name} with the connector’s name.