Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB support for Prisma 2+ #1277

Closed
gotenxds opened this issue Jan 6, 2020 · 86 comments
Closed

MongoDB support for Prisma 2+ #1277

gotenxds opened this issue Jan 6, 2020 · 86 comments
Assignees
Labels
kind/feature A request for a new feature. team/client Issue for team Client. team/schema Issue for team Schema. topic: connector topic: mongodb
Milestone

Comments

@gotenxds
Copy link

gotenxds commented Jan 6, 2020

Our team is considering working with Prisma, but as Prisma 1 seems to go out of scope and prisma 2 not mongo ready yet would love to know when is support expected to be released? a week? a month ? 2021 ?

@nikolasburk nikolasburk changed the title mongodb support, when MongoDB support for Prisma 2 Jan 8, 2020
@nikolasburk
Copy link
Member

Hey @gotenxds, thanks a lot for opening this issue! While we can't commit to a concrete timeline, our current plans are to tackle MongoDB support some time this year. Right now we're focussed on making Prisma stable and resilient for relational DBs, we'll post updates on MongoDB support once the initial, production-ready releases of Prisma 2 are done.

Note that we'll keep this issue open as a tracking issue for MongoDB support (I also took the liberty of updating the title to make this a bit more clear).

@nikolasburk nikolasburk added kind/feature A request for a new feature. and removed kind/question labels Jan 8, 2020
@nikolasburk nikolasburk removed their assignment Jan 8, 2020
@macrozone
Copy link

@nikolasburk as development of prisma 1 seems to have completly staled, we are now in a bad position. We want to continue to use mongodb with prisma, in particular because embedded objects make a lot of sense for the kind of content we are dealing with.

But on the other hand there are a lot of flaws and bugs with prisma1 and embedded objects. It would probably a good idea to at least take a look at these issues (and maybe even fix that on version 1), so that they won't occur on prisma2.

@nikolasburk
Copy link
Member

Hey @macrozone, I'm really sorry that we're currently unable to fix your situation. As I mentioned, unfortunately we can't commit to a timeline but we're already collaborating with the folks from MongoDB and they're in the process of building a MongoDB Rust driver which is required as foundation for our MongoDB connector. If the current limitations of Prisma 1 are a blocker for you and you can't afford to wait until Prisma 2's MongoDB connector is ready, it might be that you have to migrate off of Prisma for now unfortunately. I assume migrating the data to a relational database is not an option for you?

@macrozone
Copy link

Hey @macrozone, I'm really sorry that we're currently unable to fix your situation. As I mentioned, unfortunately we can't commit to a timeline but we're already collaborating with the folks from MongoDB and they're in the process of building a MongoDB Rust driver which is required as foundation for our MongoDB connector. If the current limitations of Prisma 1 are a blocker for you and you can't afford to wait until Prisma 2's MongoDB connector is ready, it might be that you have to migrate off of Prisma for now unfortunately. I assume migrating the data to a relational database is not an option for you?

yes, we are evaluating to use postgres instead of mongodb. Unfortunatly, embed types are still not implemented in prisma2: #1277 (comment)

@macrozone
Copy link

@nikolasburk just wanted to tell you that we now using prisma2 with postgres (from google cloud) and we love it so far! (in particular with nexus) I hope you guys can keep the momentum!

@duro
Copy link

duro commented Mar 31, 2020

Getting this working with Mongo would be a god send. Mongoose + TypeScript (using Typegoose) is still painful. Mongoose just has some inherent design principles that make type safe usage very tedious and manual. +1 x1000

@raulingg
Copy link

raulingg commented Apr 2, 2020

I'm looking forward to seeing support for MongoDB, that would be a huge addition to Prisma.

@kalebjdavenport
Copy link

kalebjdavenport commented Apr 7, 2020

Can't wait to see what you guys come up with for MongoDB. NoSQL DBs are becomming more common for early companies and startups to use, so if your tooling could build on top of MongoDB there would be a massive amount of interest from new companies to use Prisma!

@andyWynyard
Copy link

I have a new project we are kicking off at work and I was really hoping I could build a POC for Prismic 2 for it over easter. Unfortunately, we are kinda tightly bound with MongoDB, and it would be a difficult sell to the higher-ups to go a different direction. I really hope you guys can get this one nailed down.

@jellz
Copy link

jellz commented Apr 10, 2020

Really looking forward to Mongo support, hope it comes really soon, will definitely be using this with Mongo in the future.

@patrick-samy
Copy link

patrick-samy commented Apr 17, 2020

Out of curiosity, would it be possible and sensible to implement our own database connector for MongoDB or BigTable for example? Or would it just be easier to implement a wrapper at the API level in resolvers?

@saghm
Copy link

saghm commented Apr 23, 2020

Hello! I'm one of the developers of the MongoDB Rust driver, so I just wanted to pop in and give an update about the status of the driver. We just recently completed our rewrite of the driver internals to be async, and we're now finishing up the last few features we need to be able to release our first beta of the driver, which should have everything that's needed for adding MongoDB support to Prisma.

Thanks for your patience while waiting for us to finish up our work on the driver; we hope to have something ready soon!

@saghm
Copy link

saghm commented May 5, 2020

Hello again! Just following up to let every know we released the first beta for the MongoDB Rust driver, v0.10.0, just moments ago, so async support is fully available for the driver.

@harisvsulaiman
Copy link

@saghm That is Wonderfull news! Looking forward to using it.

@Mi3liX9
Copy link

Mi3liX9 commented May 6, 2020

I'm so excited to use Prisma 2 with Mongodb 😍👍

@lcswillems
Copy link

@saghm How to use it? Does it come directly with Prisma?

@sorenbs
Copy link
Member

sorenbs commented May 6, 2020

Hey @lcswillems and everybody else waiting for MongoDB Support in Prisma.

@saghm is on the engineering team at Mongo who did an excellent job at implementing a MongoDB driver for the Rust programming language, which is used in the Prisma Query Engine. Based on this work, we are now working on creating a MongoDB connector for Prisma. I can't give you a timeline for MongoDB support, but we definitely appreciate the excitement in the community as evidenced by reactions in this thread.

I want to thank the MongoDB team for their excellent collaboration, and I look forward to sharing the result of this work with the wider Prisma community soon.

@andyWynyard
Copy link

Hey @lcswillems and everybody else waiting for MongoDB Support in Prisma.

@saghm is on the engineering team at Mongo who did an excellent job at implementing a MongoDB driver for the Rust programming language, which is used in the Prisma Query Engine. Based on this work, we are now working on creating a MongoDB connector for Prisma. I can't give you a timeline for MongoDB support, but we definitely appreciate the excitement in the community as evidenced by reactions in this thread.

I want to thank the MongoDB team for their excellent collaboration, and I look forward to sharing the result of this work with the wider Prisma community soon.

Reactions, hell yes, and they are all positive. Super can't wait for this. Will be doing a POC for our company (currently too many API's and crap all over the place) and we are all in on MongoDB.

This is going to be fun 👍

@var
Copy link

var commented May 8, 2020

Hey @lcswillems and everybody else waiting for MongoDB Support in Prisma.

@saghm is on the engineering team at Mongo who did an excellent job at implementing a MongoDB driver for the Rust programming language, which is used in the Prisma Query Engine. Based on this work, we are now working on creating a MongoDB connector for Prisma. I can't give you a timeline for MongoDB support, but we definitely appreciate the excitement in the community as evidenced by reactions in this thread.

I want to thank the MongoDB team for their excellent collaboration, and I look forward to sharing the result of this work with the wider Prisma community soon.

Is there any way we could contribute? Love to help!

@dannysofftie
Copy link

Am really looking forward to see prisma2 support MongoDB. Can't wait to migrate from prisma1

@rodrigooler
Copy link

Any news about the mongo driver?

@gustawdaniel
Copy link

I would help too if I can.

@matthewmueller matthewmueller added this to the 2.22.0 milestone Apr 14, 2021
@gautamsi
Copy link

gautamsi commented Apr 18, 2021

trying to use this in keystonejs/keystone#5480; seems promising but have some caveat. looking forward for preview release

---- edit ---
My first attempt at writing tech/dev article on Medium - https://gautamsi.medium.com/mongodb-provider-for-prisma-2-and-keystone-next-1618418c8937

@noor-codes
Copy link

Prisma + MongoDB === To the sky and beyond! ❤️

@ajcwebdev
Copy link

I've done a little write up for getting setup with Prisma and MongoDB on Atlas. Lots of caveats from Matt of course, but I was able to get spun up and writing to the database seamlessly.

We also have connected the RedwoodJS example blog to a Mongo database and David said it took him under 30 minutes to get it working. A time for double rockets if there ever was one 🚀🚀

@ajcwebdev
Copy link

MongoDB support is now in Preview as of v2.27.0

Docs are looking good as well 😎.

@janpio janpio changed the title MongoDB support for Prisma 2 MongoDB support for Prisma 2+ Sep 23, 2021
@AliAlQassab
Copy link

Will the preview be supporting the new Serverless MongoDB (v5.0.3+)?
https://www.mongodb.com/cloud/atlas/serverless

@matthewmueller
Copy link
Contributor

@AliAlQassab I just created an issue for your request: #9659

@codingfunwoody
Copy link

May i know is it support upgrade from prisma1 to prisma3 with mongoDB?

@janpio janpio removed the team/pdp Issue for team Prisma Data Platform. label Jan 3, 2022
@janpio
Copy link
Member

janpio commented Feb 14, 2022

May i know is it support upgrade from prisma1 to prisma3 with mongoDB?

We have seen good success in first testing to introspect a Prisma 1 MongoDB database, and then use the resulting Prisma Schema to create a current Prisma Client. This of course requires you to update your application to use the new Prisma instead of Prisma 1.

@matthewmueller
Copy link
Contributor

matthewmueller commented Feb 28, 2022

Hey all, I just wanted to share that Embedded Document support for MongoDB is now in Preview!

It's easy to get started. First, install the latest Prisma (3.10.0) and add the mongoDb preview feature flag:

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["mongoDb"]
}

Then you'll have a new type keyword in your Prisma Schema (or will get schemas with type for your existing MongoDB databases that use Embedded Documents when running prisma db pull), for example:

model Order {
  id              String   @id @default(auto()) @map("_id") @db.ObjectId
  product         Product  @relation(fields: [productId], references: [id])
  color           Color
  size            Size
  shippingAddress Address
  billingAddress  Address?
  productId       String   @db.ObjectId
}

// New composite type!
type Address {
  street String
  city   String
  zip    String
}

Once you run prisma generate, you'll have a new type-safe API for working with these types.

For example, here's how you'd create a new Order:

const order = await prisma.order.create({
  data: {
    // Normal relation
    product: { connect: { id: 'some-object-id' } },
    color: 'Red',
    size: 'Large',
    // Composite type
    shippingAddress: {
      street: '1084 Candycane Lane',
      city: 'Silverlake',
      zip: '84323',
    },
  },
})

This is just the tip of the iceberg. Dive deeper in our documentation.


If you have any feedback for us, I'd love to jump on a call with you.

We're actively working towards getting MongoDB production ready, so now's the time to give this a try and share your thoughts!

@ajcwebdev
Copy link

As MongoDB support continues to work its way towards GA (🚀🥳🕺), I wanted to also drop a link to a write up on the Status of RedwoodJS and MongoDB as of Early 2022.

There are a few details to still iron out to reach complete feature parity with the SQL alternatives, but we've got a lot of the pieces in place and it's more than ready for anyone interested in testing it out and providing early feedback.

@dpetrick
Copy link
Contributor

This is in GA since 3.12 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. team/client Issue for team Client. team/schema Issue for team Schema. topic: connector topic: mongodb
Projects
None yet
Development

No branches or pull requests