Prisma: 3.2.0 Release

Release date:
October 5, 2021
Previous version:
3.1.1 (released September 21, 2021)
Magnitude:
726 Diff Delta
Contributors:
5 total committers
Data confidence:
Commits:

56 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Authored October 4, 2021
Authored September 30, 2021
Authored September 27, 2021
Authored September 29, 2021
Authored September 29, 2021
Authored September 29, 2021

Top Contributors in 3.2.0

cbuchacher
Jolg42
prisma-bot
renovate-bot
millsp

Directory Browser for 3.2.0

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

Today, we are excited to share the 3.2.0 stable release 🎉

🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟 

Major improvements & new features

MongoDB introspection support is now in Preview 🚀

In this version, we introduce support for introspecting MongoDB databases. If adding Prisma to an existing project, running prisma db pull against a MongoDB database with existing data will sample the data and create a Prisma data model based on the stored documents.

This comes with a few caveats:

  • The preview feature mongoDb must be enabled on the datasource block in the Prisma schema.
  • The MongoDB instance must have at least one collection with at least one document.
  • To introspect indices, there must be at least one document in the collection with the indexed fields.
  • If any fields have conflicting types, the most common type is chosen and the other types are written to a comment above the field in the Prisma schema.
  • Relations must be added manually after introspection.
  • Running prisma db pull multiple times will overwrite any manual changes to the data model for now.

We're constantly iterating on this feature, so please provide feedback for introspecting MongoDB databases!

Get the count of a relation in MongoDB

This release, we're giving MongoDB developers the ability to query the count of a relation. In the example below, we're getting the number of posts each user wrote:

const userWithPostsCount = await prisma.user.findMany({
  include: {
    _count: {
      select: { posts: true },
    },
  },
})

// => [
//      { 
//        email: "[email protected]",
//        _count: { posts: 3 }
//      }
//    ]

This feature was previously available for SQL databases and now it's also available in MongoDB. Learn more in our documentation.

Fixes and improvements

Prisma Migrate

Prisma Client

Prisma

Prisma Studio

Credits

Huge thanks to @otan, @cbuchacher for helping out in this release!

CTA

📺 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" livestream.

The stream takes place on Youtube on Thursday, October 07 at 5pm Berlin | 8am San Francisco.