> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abundly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB

> Let your agent read and write your MongoDB data using your own database connection

Your agent can run commands against your MongoDB database — finding documents, running aggregations, inserting records, and updating data — all in plain English. Point it at your database with a connection string and ask in natural language; the agent translates your request into MongoDB commands and returns the results.

Unlike read-only data integrations, what the agent can do is governed entirely by the database user in your connection string. Connect with a read-only user and the agent can only read; connect with a read-write user and it can also insert, update, and delete. You stay in control by choosing the permissions of the user you connect with.

## How to enable

Go to **Settings → Capabilities** and enable **MongoDB**, then link a workspace secret containing your **connection string**. The same secret can be reused across agents and teams.

## What you need

All the agent needs is a standard MongoDB **connection string** (URI), for example:

```
mongodb+srv://user:password@cluster.mongodb.net
```

The connection string is stored as an encrypted workspace secret. It includes the database user's credentials, so the user's permissions determine exactly what the agent is allowed to do.

<Tip>
  Create a dedicated database user for the agent with only the permissions it needs. If the agent should only answer questions about your data, give it a read-only user. If it should also maintain records, give it read-write access to the relevant database.
</Tip>

## Default database

The capability card has an optional **Default Database** field. This is the database the agent uses when a request doesn't name one explicitly.

* **If set** — the agent works against that database by default, so you can just ask "how many orders do we have?" without naming the database every time.
* **If left empty** — the agent must specify a database on every command. Set a default if your agent mostly works with a single database.

The agent can always target a different database when you ask it to, regardless of the default.

## Which MongoDB can I use?

Any MongoDB database that accepts a standard connection string works — self-hosted, MongoDB Atlas, or any managed provider.

If you don't have a database yet, you can start for free with [MongoDB Atlas](https://www.mongodb.com/atlas), MongoDB's hosted service, which offers a free tier that's plenty for getting started. You're not locked in — the same connection string approach works with any MongoDB instance, so you can move to a paid tier or your own infrastructure later.

## IP allowlisting

If your database restricts access by IP address (for example, MongoDB Atlas network access rules), allow Abundly's outbound IP address:

```
34.51.233.91
```

<Note>
  Enterprise customers connect from a different, dedicated IP address. If you're an enterprise customer and need to allowlist Abundly, [contact us](mailto:support@abundly.ai) and we'll provide your specific address.
</Note>

## Example use cases

* **Ask questions about your data** — "How many active users signed up in the last 30 days? Use the analytics database in MongoDB"
* **Reporting** — "Every Monday, count last week's orders by status and post a summary to Slack"
* **Maintaining records** — "Add this support ticket to the tickets collection" (with a read-write user)
* **Exploration** — "List the collections in our app database and show me a sample document from the users collection"
* **Data checks** — "Find any orders in MongoDB with a missing customer ID and flag them"

## How to connect MongoDB

<Steps>
  <Step title="Create a database user">
    In your MongoDB provider (e.g. Atlas) or your self-hosted instance, create a database user for the agent. Grant only the permissions it needs — read-only if the agent should only query, read-write if it should also modify data.
  </Step>

  <Step title="Allowlist Abundly's IP (if required)">
    If your database restricts access by IP, add Abundly's outbound IP `34.51.233.91` to the allowlist. Enterprise customers should contact Abundly for their dedicated address.
  </Step>

  <Step title="Configure in Abundly">
    Go to **Settings → Capabilities**, enable **MongoDB**, and create a new workspace secret of type **MongoDB** containing your connection string. Optionally set a **Default Database** so the agent doesn't need it specified on every request.
  </Step>
</Steps>

## Learn more

<CardGroup cols={3}>
  <Card title="Agent databases" icon="database" href="/features/agent-databases">
    Store and query structured data inside Abundly — no external database needed.
  </Card>

  <Card title="BigQuery" icon="database" href="/integrations/bigquery">
    Query and explore your Google BigQuery data from the agent.
  </Card>

  <Card title="Snowflake" icon="snowflake" href="/integrations/snowflake">
    Query and explore your Snowflake data warehouse from the agent.
  </Card>
</CardGroup>
