Today, we are excited to share the 5.14.0
stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release. 🌟
Highlights
Share your feedback about Prisma ORM
We want to know how you like working with Prisma ORM in your projects! Please take our 2min survey and let us know what you like or where we can improve 🙏
createManyAndReturn()
We’re happy to announce the availability of a new, top-level Prisma Client query: createManyAndReturn()
. It works similarly to createMany()
but uses a RETURNING
clause in the SQL query to retrieve the records that were just created.
Here’s an example of creating multiple posts and then immediately returning those posts.
const postBodies = req.json()['posts']
const posts = prisma.post.createManyAndReturn({
data: postBodies
});
return posts
Additionally,createManyAndReturn()
supports the same options as findMany()
, such as the ability to return only specific fields.
const postBodies = req.json()['posts']
const postTitles = prisma.post.createManyAndReturn({
data: postBodies,
select: {
title: true,
},
});
return postTitles
Full documentation for this feature can be found in the Prisma Client API Reference.
Note: Because createManyAndReturn()
uses the RETURNING
clause, it is only supported by PostgreSQL, CockroachDB, and SQLite databases. At this time, relationLoadStrategy: join
is not supported in createManyAndReturn()
queries.
MongoDB performance improvements
Previously, Prisma ORM suffered from performance issues when using the in
operator or when including related models in queries against a MongoDB database. These queries were translated by the Prisma query engine in such a way that indexes were skipped and collection scans were used, leading to slower queries especially on large datasets.
With 5.14.0, Prisma ORM now rewrites queries to use a combination of $or
and $eq
operators, leading to dramatic performance increases for queries that include in
operators or relation loading.
Fixes and improvements
Prisma Client
createMany()
should return the created records- Generating Prisma client without any model in its schema
- MongoDB: Performance issue with nested
take
on many-to-one relationship - Slow queries on MongoDB using
include
for relations - [MongoDB] Performance issue in
findMany()
query execution within
- MongoDB nested/
include
query slow - MongoDB Connector generates queries which do not take advantage of indices.
- Mongodb Nested Queries Not Using Indexes
- MongoDB slow delete with
onDelete: SetNull
- Slow query with many-to-one relationship on MongoDB
prisma init --with-model
- Fixed version of
@opentelemetry/*
dependencies - Usage of deprecated punycode module
- Bug: D1 One-to-Many Relation INSERTs fail with
The required connected records were not found.
when using indices
Prisma Migrate
- Empty
dbgenerated()
still breaking forUnsupported()
types - Validation error when
shadowDatabaseUrl
is identical tourl
(ordirectUrl
) - MongoDB Query with 'in' condition will cause COLLSCAN, without leveraging indexes
- "Not Authorised" when directly applying Prisma generated migrations to Cloudflare D1 with
PRAGMA foreign_key_check;
Language tools (e.g. VS Code)
- make superior: model generate
- Missing code autocomplete for referential actions with mongodb
- add codelens provider w/ generate client command
Company news
Prisma Changelog
Curious about all things Prisma? Be sure to check out the Prisma Changelog for updates across Prisma's products, including ORM, Accelerate, and Pulse!
New product announcement: Prisma Optimize
With this release, we are excited to introduce a new Prisma product. We’re calling it “Optimize” because that’s what it does! Let your favorite ORM also help you debug the performance of your application.
Check out our announcement blog post for more details, including a demo video.
Credits
Huge thanks to @pranayat, @yubrot, @skyzh, @anuraaga, @gutyerrez, @avallete, @ceddy4395, @Kayoshi-dev for helping!