# MongoDB (/docs/next/quickstart/mongodb)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

Create a new Prisma Next project with MongoDB using create-prisma@next.

Location: Next > Quickstart > MongoDB

Create a Prisma Next app with MongoDB, seed it, and run your first query.

> [!NOTE]
> Prisma Next is in Early Access
> 
> Prisma Next is the next major version of Prisma ORM, available now in Early Access. It’s the cutting-edge version of Prisma ORM and will become the future of Prisma, so we’d love for you to try it, explore what’s new, and [share your feedback in Discord](https://pris.ly/discord).
> 
> If you want to stay on the current generally available version of Prisma ORM, you can continue with [Prisma 7](https://www.prisma.io/docs/getting-started).

## Quick start [#quick-start]

  

#### bun

```bash
bunx create-prisma@next --provider mongodb
```

#### pnpm

```bash
pnpm dlx create-prisma@next --provider mongodb
```

#### yarn

```bash
yarn dlx create-prisma@next --provider mongodb
```

#### npm

```bash
npx create-prisma@next --provider mongodb
```

Run this from a Node.js 24 or newer environment. The command preselects MongoDB. The generated local setup gives you a MongoDB replica set through `db:up`; if you use MongoDB Atlas or another existing deployment, set `DATABASE_URL` and skip `db:up`.

Setup gives you the app template, a starter contract, `prisma-next.md`, project-level Prisma Next skills for your coding agent, and package scripts for the database steps below.

For local development, use a replica set. MongoDB Atlas already provides one, and the generated `db:up` script starts one for you.

## 1. Check the database connection [#1-check-the-database-connection]

Open `.env` and confirm that `DATABASE_URL` points to the MongoDB deployment you want Prisma Next to use.

```text title=".env"
DATABASE_URL="mongodb://127.0.0.1:27017/app?replicaSet=rs0"
```

If you use MongoDB Atlas, replace this with the connection string from your Atlas cluster.

## 2. Start MongoDB [#2-start-mongodb]

From the generated project directory, run `db:up` to start the local replica set.

  

#### bun

```bash
bun run db:up
```

#### pnpm

```bash
pnpm run db:up
```

#### yarn

```bash
yarn db:up
```

#### npm

```bash
npm run db:up
```

Skip this command when you use MongoDB Atlas or another existing deployment.

## 3. Create the migration plan [#3-create-the-migration-plan]

Create the first migration plan from the starter contract.

  

#### bun

```bash
bun run migration:plan --name init
```

#### pnpm

```bash
pnpm run migration:plan --name init
```

#### yarn

```bash
yarn migration:plan --name init
```

#### npm

```bash
npm run migration:plan -- --name init
```

## 4. Apply the migration [#4-apply-the-migration]

Apply the planned migration to MongoDB.

  

#### bun

```bash
bun run migrate
```

#### pnpm

```bash
pnpm run migrate
```

#### yarn

```bash
yarn migrate
```

#### npm

```bash
npm run migrate
```

## 5. Seed data [#5-seed-data]

`db:seed` inserts sample users so the first query has data to show.

  

#### bun

```bash
bun run db:seed
```

#### pnpm

```bash
pnpm run db:seed
```

#### yarn

```bash
yarn db:seed
```

#### npm

```bash
npm run db:seed
```

## 6. Run the app [#6-run-the-app]

Start the app and confirm the sample query runs successfully.

  

#### bun

```bash
bun run dev
```

#### pnpm

```bash
pnpm run dev
```

#### yarn

```bash
yarn dev
```

#### npm

```bash
npm run dev
```

Use the URL or terminal output shown by your template. You should see the seeded users returned from MongoDB.

## Next steps [#next-steps]

* Open `src/prisma/contract.prisma` or `src/prisma/contract.ts` and change the starter model.
* Use the [MongoDB existing-project guide](https://www.prisma.io/docs/next/add-to-existing-project/mongodb) if you already have an app and database.
* Read the [Prisma Next overview](https://www.prisma.io/docs/orm/next) when you want the concepts behind contracts, query APIs, and migrations.

## Related pages

- [`PostgreSQL`](https://www.prisma.io/docs/next/quickstart/postgresql): Create a new Prisma Next project with PostgreSQL using create-prisma@next.