**Note** that `SERVER_PATH_TO_MONGODB_DUMP_DIRECTORY` must be a path to a **gzipped** MongoDB dump directory on the server (not on your local machine!)
## Maintenance
This section shows you how to perform various maintenance tasks related to the MongoDB database server used by various components of this playbook.
Table of contents:
- [Getting a database terminal](#getting-a-database-terminal), for when you wish to execute SQL queries
You can use the `/mash/mongodb/bin/cli` tool to get interactive terminal access using the MongoDB Shell [mongosh](https://www.mongodb.com/docs/mongodb-shell/).
By default, this tool puts you in the `admin` database, which contains nothing.
To see the available databases, run `show dbs`.
To change to another database (for example `infisical`), run `use infisical`.
To see the available tables in the current database, run `show tables`.
You can then proceed to write queries. Example: `db.users.find()`
**Be careful**. Modifying the database directly (especially as services are running) is dangerous and may lead to irreversible database corruption.
When in doubt, consider [making a backup](#backing-up-mongodb).
### Backing up MongoDB
To make a one-off back up of the current MongoDB database, make sure it's running and then execute a command like this on the server: