# Mongo Service

URL: /docs/services/mongo

Source: https://github.com/easypanel-io/monorepo/blob/main/apps/website/content/docs/services/mongo.mdx

Run and operate a persistent MongoDB database.



The Mongo service runs the official MongoDB Docker image with persistent
storage, generated credentials, connection URLs, optional browser
administration tools, scheduled backups, and resource controls.

## Create a Mongo service [#create-a-mongo-service]

1. Open a project and select **New Service**.
2. Select **MongoDB** and enter a service name.
3. Optionally set the user, password, and Docker image.
4. Create the service and wait for it to start.
5. Open **Credentials** and copy the internal connection URL into the
   application that needs the database.

When omitted, the user defaults to `mongo` and Easypanel generates the
password. Leaving the image empty uses Easypanel's default official MongoDB
image.

## Overview [#overview]

The overview provides start, stop, logs, notes, and destroy actions. Its Shell
menu can open Bash or `mongosh` using the service's root credentials.

The page also shows runtime metrics, recent logs, detected errors, and two
optional administration tools:

* **Mongo Express** provides a MongoDB-focused browser interface.
* **DbGate** provides a general database browser.

Enable a tool only when needed and disable it afterward. Easypanel gives each
tool a generated access token and a dedicated domain.

## Credentials [#credentials]

The Credentials tab shows:

* user and password;
* internal host and port `27017`;
* internal connection URL;
* external host, port, and connection URL when the service is exposed.

Services in the same Easypanel project should use the internal connection URL.
The internal host is derived from the project and service names and is
reachable on the private service network.

Select **Edit** to change the password. Easypanel updates the MongoDB user and
redeploys connected Mongo Express or DbGate tools. Update every application
that uses the old password.

<Callout type="warn">
  The current credential rotation flow targets the default `mongo` user. Do not
  use it for a service created with a custom username.
</Callout>

The generated URL contains `tls=false`. If an application needs a database
name or authentication source, add the client options required by that
application without discarding the generated host and credentials.

## Expose [#expose]

MongoDB is private by default. The Expose tab publishes it on the server so
that an external database client can connect. Saving the exposed port restarts
the service and adds external values to the Credentials tab.

Prefer the internal connection for applications hosted in Easypanel. If remote
access is required, restrict the port with the server or provider firewall and
use a unique published port.

## Backups [#backups]

The Backups tab creates logical database backups in a configured storage
provider. A backup configuration includes the database name, enabled state,
cron schedule, retention count, storage provider, and destination path.

You can run a backup immediately, edit or remove its schedule, restore a backup
file, and review the backup action log. Configure the destination first under
the server's storage provider settings.

Test a manual backup and restore on non-production data before relying on a
schedule. See [Database Backups](/docs/backups/database) for destination setup,
retention behavior, and restore precautions.

## Resources [#resources]

Configure memory reservations and limits in MB, and CPU reservations and limits
in cores. Set a value to `0` for unlimited resources. Saving these settings
restarts the service.

Leave headroom for indexes, aggregation, backups, and peak load. MongoDB uses
memory for its working set, so an aggressive limit can reduce performance or
terminate the service.

## Advanced [#advanced]

Advanced settings can override the Docker image and command and add environment
variables using `.env` syntax. Saving Advanced settings redeploys the database.

Use a command override only when you understand the image entrypoint. Put
supported official MongoDB image variables in Environment.

<Callout type="warn">
  Image, command, and environment changes can prevent MongoDB from starting or
  make an existing data directory incompatible. Take a verified backup and
  review MongoDB's upgrade path before changing major versions.
</Callout>

## Data and deletion [#data-and-deletion]

MongoDB stores its data on the server at:

```text
/etc/easypanel/projects/[project]/[service]/data
```

The directory is mounted at `/data/db` in the container. Destroying the service
permanently removes its database files and configuration. Verify an external
backup before confirming deletion.
