- Adding MongoDB support to Prisma
- Making MongoDB type safe with Prisma
- Getting started
- Try Prisma with MongoDB and share your feedback
- Prisma release 2.27.0 adds Preview support for MongoDB.
- Prisma introduces a schema to MongoDB from which Prisma Client is generated, giving you the power of type safety in your queries.
- Check out the Start from scratch guide in the docs.
- This is a preview release, so there may be bugs and breaking changes. Try it out and share your feedback
Watch the getting started video: MongoDB with Prisma
MongoDB has been our most requested feature since the release of Prisma 2. Today we're thrilled to announce Preview support for MongoDB in Prisma! 🎉
Earlier this year, we released an Early Access of the MongoDB connector to Prisma Client. Since then, hundreds of engineers signed up for the Early Access program and provided us with helpful feedback.
This release marks a significant milestone in bringing the benefits of Prisma to more developers by adding support for MongoDB.
MongoDB support has passed rigorous testing internally and by the Early Access participants and is now ready for broader testing by the community. However, as a Preview feature, it is not production-ready. To read more about what preview means, check out the maturity levels in the Prisma docs.
Thus, we're inviting the MongoDB community to try it out and give us feedback so we can bring MongoDB support to general availability. 🚀
Unlike the already supported SQL databases in Prisma, MongoDB is a NoSQL database that makes different assumptions about how to model your data and how you query it.
MongoDB's collections, by default, do not require their documents to have the same schema. While this is one of the benefits of MongoDB, it comes at a cost – as a developer, you have the burden of ensuring the consistency and integrity of your data.
For example, documents in a single collection do not need to have the same set of fields and can have different types for the same field. As your application and data model evolve and you add new fields, it is up to you to manage the complexity of all possible variants of a document in the application layer.
Prisma addresses the challenges of a dynamic schema by allowing you to define and enforce a schema.
You define your data model using Prisma Schema – Prisma's declarative data modeling language.
After defining your Prisma schema, you auto-generate the TypeScript Prisma Client and use it in your application to interact with the database with type safety for all queries. Prisma Client leverages TypeScript's type system to map your Prisma schema models to types, so for every query you write, the exact return type is inferred.
“Prisma 2 is a great platform to build mix:analog on. I’m migrating our whole backend to it and it has been a joy to work with. Our current 2.x backend is MongoDB / NodeJS with no TypeScript and Prisma has enabled us to move to a more type safe environment with Postgres/Typescript”Bojan Šernek, CEO @ Distopik d.o.o.
“By using Prisma's MongoDB adapter for the Uberblick project, we skyrocketed our new SaaS project from scratch to a production-ready MVP in just three days. Prisma allowed us to quickly iterate and move forward with our database while keeping its ease of use and the flexibility of MongoDB”Tobias Möritz, Freelance design engineer @ Coralic
“I have worked with Prisma for over a year now and most recently built the site www.autoauction.co.uk. I absolutely love using it as an ORM tool and will continue to build it into my applications going forward. It has done a great job abstracting away granular details requisite to integrating MongoDB into your application. I think the community is fantastic and full of people willing to help each other out, and I very much look forward to what Prisma 2 brings in terms of MongoDB.”Taylor Lindores-Reeves, Director @ Digital Speed
“We are using Prisma for various internal products such as MDM application for managing our products, Robot command center (our company includes robotics division). Using Prisma, the speed of the development increased and we are eagerly waiting for NoSQL support. I had to develop backend for a demo application which i was able to do in single night using Prisma. There are no words to express how happy we are at the rate of development. It would be great if Prisma includes a rollback feature in the migration tool.”Naveen Sakthivel, CTO @ Dotworld Technologies
This release allows you to use Prisma Client in new MongoDB projects.
To get started with MongoDB, check out the Start from scratch guide in the docs.
If you prefer a guided video, check out the MongoDB with Prisma video.
You can also dig into our ready-to-run example in the
prisma-examples repo which includes instructions on how to start a MongoDB server locally and some example scripts to demonstrate Prisma Client queries.
Support for MongoDB comes with some limitations that are detailed in this section.
- MongoDB replica set is required for transactions
- Prisma Migrate is not supported yet
- Introspection is not supported
- Unique indices need to be created manually
- Limited support for embedded documents (currently only possible with the Json type)
We built this for you and are eager to hear your feedback!
🐜 Tried it out and found that it's missing something or stumbled upon a bug? Please file an issue so we can look into it.
💡 Are you interested in learning more about MongoDB? Check out the MongoDB section of Prisma's Data Guide.
🌍 We also invite you to join our Slack where you can discuss all things Prisma, share feedback in the
#mongodb channel, and get help from the community.
🎥 Watch the Making MongoDB Type Safe with Prisma talk at MongoDB.live on July 14th 19:45 CEST.
📫 Sign up for the MongoDB mini-newsletter to get the latest updates on MongoDB support in Prisma.
🏗 We are excited to share the preview version of MongoDB support in Prisma finally and can't wait to see what you all build with it.
Get started with Prisma and MongoDB