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

# Updating Local Database

> Export MongoDB Atlas and restore into a local MongoDB for Meridian development

Use this when you need **tenant data from MongoDB Atlas** in a **local MongoDB** that Meridian’s backend already points at via `Meridian/backend/.env`. The Atlas connection string is the same credential set used for that environment (staging snapshot, shared dev cluster, etc.)—not checked into this documentation.

## Step 1: Export the MongoDB Atlas Database

Export the Atlas database to a BSON dump using `mongodump`.

1. **Export the database**

   Use `mongodump` with the **Atlas URI** from `Meridian/backend/.env` (for example `MONGO_URI_RPI`, `MONGODB_URI`, or the Atlas SRV string used for that tenant). Pick a writable dump directory (examples: `~/dump` on macOS/Linux, `C:\temp\meridian-dump` on Windows):

   ```sh theme={null}
   mongodump --uri="<ATLAS_URI_FROM_ENV>" --out=/path/to/dump
   ```

<Note>
  The dump directory is disposable after `mongorestore`; keep it off shared drives if the snapshot contains PII.
</Note>

## Step 2: Import the dump into local MongoDB

Import the BSON dump with `mongorestore`.

1. **Import the database**

   Run `mongorestore` with the dump path and the database name (e.g. `studycompass`):

   ```sh theme={null}
   mongorestore --db studycompass --drop /path/to/dump/studycompass
   ```

<Note>
  `mongodump` writes a folder per database name under `--out`. Point `mongorestore` at that inner folder (for example `.../dump/studycompass` if the database name is `studycompass`).
</Note>

Use the **same database name** locally that Meridian expects (often `studycompass` or the tenant DB name in `.env`). Replace `/path/to/dump/...` with the actual dump path from step 1.

***

## Related pages

<CardGroup cols={2}>
  <Card title="Getting started" icon="rocket" href="/getting-started">
    `.env` and Mongo URIs this restore process must match.
  </Card>

  <Card title="Development" icon="wrench" href="/development">
    Running the backend against your local database after restore.
  </Card>

  <Card title="Multi-tenant identity" icon="users" href="/backend/multi-tenant-identity">
    How tenant DB names and the global DB relate when testing SSO locally.
  </Card>

  <Card title="Deployment" icon="cloud" href="/deployment">
    Database checklist items before promoting schema or data-dependent changes.
  </Card>

  <Card title="Meridian CLI" icon="terminal" href="/meridian-cli">
    Workspace layout and branch flow around the same mono-repo.
  </Card>

  <Card title="Testing" icon="flask" href="/testing">
    Run tests after a restore when validating multi-tenant behavior.
  </Card>
</CardGroup>
