Prisma 3.10.0stable Released Feb 22, 2022
⚠️ Breaking Change Impact Score: 7/10

Prisma 3.10.0 β€” Release Notes & Engineering Impact

Source available β€” automated, not human-reviewed

Component: prisma Β· Channel: stable. Automated analysis, not a compatibility certification. How this works.

Analysis updated: 2026-11-01.

Breaking-change evidence from the source

  • We are working towards a stable release of MongoDB and are shipping lots of improvements. **All the new features and changes in this release therefore only apply to the MongoDB connector.** Take a closer look if you are using the [Preview](https://www.prisma.io/docs/about/prisma/releases#preview) of MongoDB as some of the changes are breaking.
Read the original context β†—
Source flags breaking changes β€” review applicability
$ npm install --save-dev --save-exact [email protected]
πŸ“„ .MD
⚑ Executive Summary (TL;DR)

Prisma 3.10.0. Source highlight: Today, we are excited to share the `3.10.0` stable release πŸŽ‰

Who Does This Impact? (Role-Based Analysis)

πŸ’» Software Engineers & Devs

Check the source notes against the package and APIs you use before upgrading.

πŸ“Š Product & Engineering Leads

Use the documented changes to assess relevance to your product; release frequency alone is not a quality measure.

βš™οΈ DevOps & Security

Verify the target version, runtime requirements and rollback procedure in the official documentation.

⚠️ Breaking Changes & Deprecations (1)

  • We are working towards a stable release of MongoDB and are shipping lots of improvements. **All the new features and changes in this release therefore only apply to the MongoDB connector.** Take a closer look if you are using the [Preview](https://www.prisma.io/docs/about/prisma/releases#preview) of MongoDB as some of the changes are breaking.

✨ New Features & Capabilities (4)

  • "experimental feature, needs to be enabled"
  • Add mongodb 4.2 to tested versions on migrate & introspection
  • `interactiveTransactions` feature breaks long running transactions
  • [MongoDB: add test on TS side for ObjectId arrays `a_ids String[] @db.ObjectId`](https://github.com/prisma/prisma/issues/11632)

⚑ Performance & Enhancements (1)

  • Improve error on default values when `@db.ObjectId` isn't present
πŸ“„ View Raw Release Notes (Original Developer Log)
Today, we are excited to share the `3.10.0` stable release πŸŽ‰ 🌟 **Help us spread the word about Prisma by starring the repo or [tweeting](https://twitter.com/intent/tweet?text=Check%20out%20the%20latest%20@prisma%20release%20v3.10.0%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/prisma/prisma/releases/tag/3.10.0) about the release.** 🌟 ## Major improvements and new features We are working towards a stable release of MongoDB and are shipping lots of improvements. **All the new features and changes in this release therefore only apply to the MongoDB connector.** Take a closer look if you are using the [Preview](https://www.prisma.io/docs/about/prisma/releases#preview) of MongoDB as some of the changes are breaking. ### Embedded documents support is now in Preview We're super excited to announce that Prisma version `3.10.0` supports reading and modifying embedded documents. Embedded documents will provide access to a new `type` keyword in your Prisma schema that you can use to define composite types. ```prisma datasource db { provider = "mongodb" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" previewFeatures = ["mongoDb"] } model Product { id String @id @default(auto()) @map("_id") @db.ObjectId name String photos Photo[] } type Photo { height Int width Int url String } ``` Given the schema above, you can now read and write to the embedded `photos` array: ```ts // Create a new product with an embedded list of photos const product = await prisma.product.create({ data: { name: "Forest Runners", // Create an embedded list of photos in the product photos: [ { height: 100, width: 200, url: "1.jpg" }, { height: 300, width: 400, url: "2.jpg" }, ], }, }) ``` Best of all, the query is entirely type-safe! This scratches the surface of what's possible with embedded documents. You can read further in [our documentation](https://www.prisma.io/docs/concepts/components/prisma-client/composite-types). If you run into anything, feel free to [open an issue](https://github.com/prisma/prisma/issues/new/choose), and we’ll give you a hand! ### Introspection of embedded documents is now enabled by default We added Preview support for Introspection of embedded documents in version `3.4.0` and are now activating it for all users. Running `prisma db pull` against your MongoDB database will generate `type` definitions within your Prisma schema. When introspecting your database, you can switch off the depth with `--composite-type-depth=0`, or limit it with, for example, `--composite-type-depth=2`. Feel free to drop your feedback on the feature on [GitHub](https://github.com/prisma/prisma/issues/10016). ### `@default(dbgenerated())` is now replaced with `@default(auto())` The original purpose of `dbgenerated` is to support SQL expressions Prisma doesn’t understand yet. However, MongoDB doesn’t have a concept of default value expressions like SQL does. We took this opportunity to simplify how we handle the default values in MongoDB: ```diff model Post { - id String @id @default(dbgenerated()) @map("_id") @db.ObjectId + id String @id @default(auto()) @map("_id") @db.ObjectId } ``` ### Many-to-Many relations now require a `references` argument Prisma version `3.10.0` now enforces all arguments in a MongoDB many-to-many relation. This means a `@relation` attribute must define `fields` and `references` arguments on both sides. The `fields` argument must point to a scalar field in the same model, and this scalar field must be an array. The `references` arguments must point to a scalar field in the opposite model, and it must be a singular type of the same base type as the referencing array on the other side. ```diff model Post { id String @id @map("_id") @default(auto()) @db.ObjectId category_ids String[] @db.ObjectId - categories Category[] @relation(fields: [category_ids]) + categories Category[] @relation(fields: [category_ids], references: [id]) } model Category { id String @id @map("_id") @default(auto()) @db.ObjectId post_ids String[] @db.ObjectId - posts Post[] @relation(fields: [post_ids]) + posts Post[] @relation(fields: [post_ids], references: [id]) } ``` ### `@db.Array(ObjectId)` is now updated to `@db.ObjectId` We've adjusted the Prisma schema format for scalar lists with native types (like lists of Object IDs). This will likely affect those with many-to-many relationships in MongoDB. We made this change to align MongoDB with our existing SQL databases better: ```diff model Post { id String @id @default(auto()) @map("_id") @db.ObjectId - categoryIDs String[] @db.Array(ObjectId) + categoryIDs String[] @db.ObjectId categories Category[] @relation(fields: [categoryIDs], references: [id]) } model Category { id String @id @default(auto()) @map("_id") @db.ObjectId - postIDs String[] @db.Array(ObjectId) + postIDs String[] @db.ObjectId posts Post[] @relation(fields: [postIDs], references: [id]) } ``` ## Fixes and improvements ### Prisma Migrate - [Ability to create SQL table logic from schema without doing a "migrate"](https://github.com/prisma/prisma/issues/6155) - [Improve error on default values when `@db.ObjectId` isn't present](https://github.com/prisma/prisma/issues/6429) - [Validator accepts arbitrary properties in `datasource` blocks](https://github.com/prisma/prisma/issues/7342) - [Programmatically create a MongoDB database](https://github.com/prisma/prisma/issues/8582) - [`prisma init --url` does not like `mongodb+srv://`](https://github.com/prisma/prisma/issues/9644) - [Test the error reporting backend with MongoDb](https://github.com/prisma/prisma/issues/10528) - [Better Schema validation for MongoDB](https://github.com/prisma/prisma/issues/10809) - [`Code 19` and unformatted list output during Re-Introspection](https://github.com/prisma/prisma/issues/11025) - [MongoDB Introspection Multiple Types warning message in CLI output does not differentiate models and embedded documents](https://github.com/prisma/prisma/issues/11179) - [MongoDB Introspection Embedded Documents do not require `id_` special case](https://github.com/prisma/prisma/issues/11180) - [Introspection result `Unsupported("Unknown")` causes schema validation to crash](https://github.com/prisma/prisma/issues/11181) - [Confidence Tooling run and result verification for embedded documents](https://github.com/prisma/prisma/issues/11182) - [MongoDB Introspection connects to database even when failing with error message that should not require connection to database at all](https://github.com/prisma/prisma/issues/11185) - [Change `@db.Array(ObjectId)` to `@db.ObjectId`](https://github.com/prisma/prisma/issues/11226) - [Make sure `Unsupported(...)` fields are not rejected on composite types](https://github.com/prisma/prisma/issues/11282) - [MongoDB PSL parsing should fail when using `@default(autoincrement())`](https://github.com/prisma/prisma/issues/11291) - [Error: [/root/build/libs/mongodb-schema-describer/src/lib.rs:35:41] called `Option::unwrap()` on a `None` value ](https://github.com/prisma/prisma/issues/11300) - [MongoDB embedded documents Introspection does not give any names to fields with invalid names](https://github.com/prisma/prisma/issues/11390) - [Embedded document `_id` of type `ObjectId` are introspected without native type ` @db.ObjectId`](https://github.com/prisma/prisma/issues/11396) - ["experimental feature, needs to be enabled"](https://github.com/prisma/prisma/issues/11482) - [MongoDB: On ID fields, replace `@default(dbgenerated())` with `@default(auto())`](https://github.com/prisma/prisma/issues/11552) - [Implement datamodel parser validations for two-way embedded many-to-many relations on MongoDB](https://github.com/prisma/prisma/issues/11553) - [MongoDB: The connection string format and parameters are defined by mongo-rust-driver](https://github.com/prisma/prisma/issues/11567) - [`prisma db pull` doesn't read `.env` file and errors with Environment variable not found: DATABASE_URL](https://github.com/prisma/prisma/issues/11570) - [[MDB] Do not hardcode _id to ObjectId during Introspection](https://github.com/prisma/prisma/issues/11623) - [[MDB] Schema validation error on valid composite type](https://github.com/prisma/prisma/issues/11625) - [Turn on embedded document Introspection by default](https://github.com/prisma/prisma/issues/11797) - [`Model "undefined", field: ...`](https://github.com/prisma/prisma/issues/11809) - [MongoDB Introspection does not output how many embedded documents were introspected](https://github.com/prisma/prisma/issues/11827) - [Sharded MongoDB connection string is not supported by Prisma Client](https://github.com/prisma/prisma/issues/11873) - [Add mongodb 4.2 to tested versions on migrate & introspection](https://github.com/prisma/prisma/issues/11884) - [Confirm sharded MongoDB connection string is supported by MongoDB Rust Driver](https://github.com/prisma/prisma/issues/11899) - [MongoDB: Error when no database name supplied in connection string](https://github.com/prisma/prisma/issues/11909) - [`Multiple data types found: Array(Array(Array(Double))): 86.2%, Array(Array(Array(Array(Double)))): 13.8% out of 195 sampled entries`](https://github.com/prisma/prisma/issues/11912) ### Prisma Client - [Unable to use dbgenerated uuid_to_bin for ID field: "Could not figure out an ID in create"](https://github.com/prisma/prisma/issues/7010) - [groupBy is not usable with $transaction](https://github.com/prisma/prisma/issues/7918) - [`InteractiveTransaction`: Middleware param `runInTransaction` set to `false`](https://github.com/prisma/prisma/issues/9073) - [MDBGA: Support MongoDB Atlas Serverless](https://github.com/prisma/prisma/issues/9659) - [Incorrect Typescript type for QueryEvent.timestamp](https://github.com/prisma/prisma/issues/10217) - [Using "then ()" in "interactive Transactions" initiates another transaction](https://github.com/prisma/prisma/issues/10615) - [MDBE: Write usage guide on MongoDB Embedded Documents Support](https://github.com/prisma/prisma/issues/11092) - [MongoDB first request takes ~45s on Windows](https://github.com/prisma/prisma/issues/11340) - [Prisma Client: `.count` does not work with where](https://github.com/prisma/prisma/issues/11556) - [`interactiveTransactions` feature breaks long running transactions](https://github.com/prisma/prisma/issues/11565) - [Go through the existing iTX and explore what needs to be worked on](https://github.com/prisma/prisma/issues/11574) - [Cannot extend PrismaClient class](https://github.com/prisma/prisma/issues/11628) - [MongoDB: add test on TS side for ObjectId arrays `a_ids String[] @db.ObjectId`](https://github.com/prisma/prisma/issues/11632) - [Prisma Client: Fluent API chaining not working for PascalCase columns in 3.9.1](https://github.com/prisma/prisma/issues/11641) - [Interactive transaction: Sequential Prisma Client operations timeout but work when interactive transactions are disabled](https://github.com/prisma/prisma/issues/11654) - [prisma v3.9.1: Get TypeError(read-only and non-configurable data property on the proxy target) when use jest.fn().mockReturnValue.](https://github.com/prisma/prisma/issues/11655) - [Avoid shipping unused intermediary ESM files](https://github.com/prisma/prisma/issues/11683) - [Unable to parse Connection String in Sharded MongoDB](https://github.com/prisma/prisma/issues/11684) - [Prisma Client queries are executed multiple times in `3.9.1`](https://github.com/prisma/prisma/issues/11686) - [Send `prisma` as `driverInfo` to MongoDB](https://github.com/prisma/prisma/issues/11855) - [Fluent API is no longer supported at runtime for mutations](https://github.com/prisma/prisma/issues/11861) ## Credits Huge thanks to @andyrichardson, @xnerhu, @Josh-a-e, @dusandz, @hyochan, @cesconix, @benkroeger, @YassinEldeeb, @chenkie for helping! ## πŸ“Ί Join us for another "What's new in Prisma" livestream Learn about the latest release and other news from the Prisma community by joining us for another ["What's new in Prisma"](https://www.youtube.com/watch?v=OouLYZDveBU) livestream. The stream takes place [on YouTube](https://www.youtube.com/watch?v=OouLYZDveBU) on **Thursday, February 03** at **5 pm Berlin | 8 am San Francisco**.