|
| 1 | +--- |
| 2 | +name: prisma-mongodb-upgrade |
| 3 | +description: Decision and migration guide for Prisma ORM MongoDB projects on v6, which have no upgrade path to v7. Use when a MongoDB project asks about upgrading Prisma, when "upgrade to prisma 7" comes up in a project with provider = "mongodb", or when evaluating a move to Prisma Next. Triggers on "upgrade prisma mongodb", "prisma 7 mongodb", "mongodb prisma migration", "prisma next mongodb". |
| 4 | +license: MIT |
| 5 | +metadata: |
| 6 | + author: prisma |
| 7 | + version: "0.1.0" |
| 8 | +--- |
| 9 | + |
| 10 | +# Prisma MongoDB Upgrade Path |
| 11 | + |
| 12 | +MongoDB projects are the one Prisma cohort with no road into Prisma 7: **v6 is the terminal |
| 13 | +classic-ORM major for MongoDB, and v7 never ships a MongoDB connector**. The successor path |
| 14 | +is [Prisma Next](https://github.com/prisma/prisma-next), where MongoDB support is in Early |
| 15 | +Access with GA planned after Postgres. This skill frames the real decision — migrate to |
| 16 | +Prisma Next (the encouraged path), or stay on v6 where a hard blocker applies — and carries |
| 17 | +the migration mechanics. |
| 18 | + |
| 19 | +**Never do either of these:** |
| 20 | + |
| 21 | +- Never advise a MongoDB project to "upgrade to Prisma 7". The connector does not exist |
| 22 | + there. The `prisma-upgrade-v7` guide does not apply to MongoDB projects. |
| 23 | +- Never solve the version question by rewriting the app onto a SQL database. Changing the |
| 24 | + database engine is a separate, much larger decision that is not yours to make implicitly. |
| 25 | + |
| 26 | +## The version landscape |
| 27 | + |
| 28 | +| Version | MongoDB status | |
| 29 | +|---------|----------------| |
| 30 | +| Prisma ORM v6 | Fully supported (`mongodb` provider); latest 6.x is the current stable path; maintenance line | |
| 31 | +| Prisma ORM v7 | **No MongoDB connector — not an option, ever** | |
| 32 | +| Prisma Next | MongoDB support in **Early Access**, actively developed, GA planned after Postgres — the successor path for MongoDB projects | |
| 33 | + |
| 34 | +## The decision, up front |
| 35 | + |
| 36 | +**Migrating to Prisma Next is the encouraged path.** MongoDB support in Prisma Next is Early |
| 37 | +Access: functional and moving quickly, with GA planned after Postgres — and the Prisma team |
| 38 | +wants MongoDB users to migrate early and share feedback. The migration mechanics are |
| 39 | +detailed in the references. |
| 40 | + |
| 41 | +**Staying on the latest v6 remains a legitimate choice where a hard blocker applies** — |
| 42 | +stated plainly: the Next Mongo façade does not wrap transactions yet (the underlying driver |
| 43 | +is available directly; this is expected to change soon), and pre-1.0 minors can carry |
| 44 | +breaking changes with published upgrade recipes. |
| 45 | + |
| 46 | +### Decision table |
| 47 | + |
| 48 | +| Signal | Direction | |
| 49 | +|--------|-----------| |
| 50 | +| No blockers below apply | Migrate to Next; run the `verify-cutover-checklist` and share feedback with the Prisma team | |
| 51 | +| Greenfield / prototype / internal tool | Migrate to Next | |
| 52 | +| Codebase uses multi-document transactions (`$transaction`) — check with grep, do not ask | Plan raw-driver session equivalents first (see `client-api-mapping`), or stay on v6 until the façade wrapper lands | |
| 53 | +| Team cannot absorb pre-1.0 breaking upgrades between minors | Stay on v6 until GA | |
| 54 | +| Risk-averse but interested | Run a staged Next round-trip on a copy (see `verify-cutover-checklist`), then migrate | |
| 55 | + |
| 56 | +Note: the transactions gap is expected to close soon — this section will be updated when |
| 57 | +façade transactions merge in Prisma Next. |
| 58 | + |
| 59 | +### If staying on v6: hygiene (a deliberate stay, not neglect) |
| 60 | + |
| 61 | +- Pin the Prisma packages to the latest 6.x line and keep taking 6.x patch releases. |
| 62 | +- Track Prisma release notes and security advisories for the 6.x line. |
| 63 | +- Keep the classic v6 MongoDB setup: `url = env("DATABASE_URL")` in the schema, `db push` |
| 64 | + workflow, no SQL driver adapters (see `prisma-database-setup` for the v6 MongoDB shape). |
| 65 | +- Re-evaluate when Prisma Next's MongoDB is GA, or when blockers for trying EA are resolved. |
| 66 | + |
| 67 | +## Reference files |
| 68 | + |
| 69 | +| Reference | What it covers | |
| 70 | +|-----------|----------------| |
| 71 | +| `references/decision-stay-or-migrate.md` | The full decision framing, blocker checks, and stay-hygiene detail | |
| 72 | +| `references/schema-contract-mapping.md` | v6 schema (`mongodb` provider, `@db.ObjectId`, composite types) → Next contract concepts | |
| 73 | +| `references/client-api-mapping.md` | v6 client calls → Next equivalents, incl. raw escape hatches and transactions — names map, parity does not | |
| 74 | +| `references/migrations-mapping.md` | v6 `db push`-only story → Next's plan/migrate/verify/sign flow | |
| 75 | +| `references/verify-cutover-checklist.md` | No-data-moves verification: same DB, index parity, staged round-trip before cutover | |
| 76 | + |
| 77 | +## Verified against |
| 78 | + |
| 79 | +Behavioral claims about Prisma Next in this skill were verified against |
| 80 | +[prisma/prisma-next](https://github.com/prisma/prisma-next) at commit |
| 81 | +`a2791c5dd59d579b4b3052942ae7f8fe5e2ee852` (pre-1.0, ~v0.14/0.15 line). Prisma Next moves |
| 82 | +quickly in Early Access: **before acting on any Next-side claim, verify it against the |
| 83 | +version actually installed** (check the project's `@prisma-next/*` versions and the |
| 84 | +prisma-next skills installed with it). Next's Mongo target requires MongoDB 8.0+ and expects |
| 85 | +`mongodb@^7` as a user-supplied peer dependency. |
| 86 | + |
| 87 | +## Hand-off rule |
| 88 | + |
| 89 | +This skill is the **discovery bridge**, not a replacement for Prisma Next's own |
| 90 | +documentation. After a project switches to Prisma Next, run Prisma Next's `init`/skill |
| 91 | +installation and follow its own skills (quickstart, contract, queries, migrations, runtime) |
| 92 | +for day-to-day work — do not keep working from this skill's summaries. |
0 commit comments