Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / MongoDB Atlas

MongoDB Atlas

MongoDB Atlas administration: list projects, clusters, database users, alerts, IP access list entries, organizations and process metrics through the Atlas Administration API v2, signed in with an Atlas service account. It does not read or write documents: that needs the MongoDB wire protocol (a driver), and the Atlas Data API that offered an HTTP route to documents has been retired by MongoDB.

10 actions token_login 10 read0 write Calls cloud.mongodb.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "mongodb" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Get clusterreadmongodb.get_clusterGet one Atlas cluster by name: state, type, MongoDB version, whether it is paused, backup and termination protection settings, and its connection strings.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
cluster_namestringRequiredCluster name, from list_clusters
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.get_cluster",
  input: {
    "group_id": "<group_id>",
    "cluster_name": "<cluster_name>"
  },
});
Get process metricsreadmongodb.get_process_measurementsGet time series metrics (such as OPCOUNTER_CMD, CONNECTIONS, SYSTEM_CPU_USER) for one MongoDB process over a period. Get the process ID (hostname:port) from list_processes. Granularity and either a period or a start and end are needed.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
process_idstringRequiredProcess ID as hostname:port, from list_processes
granularitystringRequiredInterval between data points as an ISO 8601 duration, e.g. PT1M, PT5M, PT1H, P1D
periodstringOptionalHow far back to report, as an ISO 8601 duration, e.g. PT1H or P1D (use instead of start and end)
mstringOptionalOne metric name, e.g. OPCOUNTER_CMD, CONNECTIONS, SYSTEM_CPU_USER; omit for all metrics
startstringOptionalStart time (ISO 8601 UTC), with end instead of period
endstringOptionalEnd time (ISO 8601 UTC)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.get_process_measurements",
  input: {
    "group_id": "<group_id>",
    "process_id": "<process_id>",
    "granularity": "<granularity>"
  },
});
Get projectreadmongodb.get_projectGet one Atlas project (group) by ID: its name, organization, creation date and cluster count.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.get_project",
  input: {
    "group_id": "<group_id>"
  },
});
List alertsreadmongodb.list_alertsList the alerts of an Atlas project, optionally only OPEN, TRACKING or CLOSED ones, with event type, affected cluster and timestamps.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
statusstringOptionalOnly alerts in this status; omit for all
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_alerts",
  input: {
    "group_id": "<group_id>"
  },
});
List clustersreadmongodb.list_clustersList the clusters in an Atlas project, returned as parallel lists (same order) of cluster names, states (IDLE, CREATING, UPDATING, DELETING, REPAIRING), MongoDB versions, types and SRV connection strings. Connection strings are addresses only; connecting to the database needs the MongoDB wire protocol, which this toolkit does not offer.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_clusters",
  input: {
    "group_id": "<group_id>"
  },
});
List database usersreadmongodb.list_database_usersList the database users defined in an Atlas project: username, authentication database and roles. Passwords are never returned.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_database_users",
  input: {
    "group_id": "<group_id>"
  },
});
List IP access listreadmongodb.list_ip_access_listList the IP access list entries of an Atlas project: the IP addresses, CIDR blocks or security groups allowed to connect, with comments and expiry.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_ip_access_list",
  input: {
    "group_id": "<group_id>"
  },
});
List organizationsreadmongodb.list_organizationsList the Atlas organizations the service account belongs to, optionally filtered by name (case-insensitive).
InputTypeDescription
namestringOptionalOnly organizations whose name matches (case-insensitive)
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_organizations",
  input: {},
});
List processesreadmongodb.list_processesList the mongod and mongos processes of an Atlas project. Each process ID (hostname:port) is what get_process_measurements needs.
InputTypeDescription
group_idstringRequiredProject (group) ID: 24 hex characters, from list_projects
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_processes",
  input: {
    "group_id": "<group_id>"
  },
});
List projectsreadmongodb.list_projectsList the Atlas projects (also called groups) the service account can see, with each project's ID, name, organization and cluster count. Start here to get the project ID the other actions need.
InputTypeDescription
items_per_pageintegerOptionalResults per page (1-500, default 100)
page_numintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mongodb.list_projects",
  input: {},
});