MongoDB: create a doc or cookbook
Prisma supports MongoDB. And in a simple POC I was able to easily migrate the Tutorial blog project from Postgres to Mongo with very little changes required.
- Generators work with MongoDB 🚀
- What will change with deployment? (I.e. no longer a need for prisma migrations, correct?)
- ?
I don't have much extra bandwidth right now to take on more projects, but I've done a decent amount of work on this over the last year so happy to help out and provide notes or guidance if anyone wants to take this on.
Relevant Links
- Generator + Scaffold Support for MongoDB
- redwood-mongo
- redwood-tutorial-mongo
- Setup MongoDB Atlas
- Getting started guide with MongoDB on Railway
TODOS
- Docs like these for using Mongo locally instead of Postgres
- Unit tests and mocks/scenarios, check testing the database section of docs
@ajcwebdev Happy to work with you on this. I've had some experience with Mongo.
@barakcodes that's awesome to hear!
Prisma has done a fantastic job with their MongoDB docs so we should also be heavily referencing those and making sure we stay up to date with the current capabilities. For example, Prisma v3.2 added Preview support for introspection.
Other upcoming features
Prisma Videos
- Using MongoDB with Prisma
- Making MongoDB Type Safe with Prisma - July
- Making MongoDB Type Safe with Prisma - September
- Install a local MongoDB Database on macOS
For a quick and easy win I'd check out the video Prisma created for installing Mongo locally and create a doc based on that.
Thanks! A pretty detailed guide, I'll get hacking on this weekend.
@ajcwebdev Started on this, it seems the only way that I could find to get Mongo to work with serverless is using Mongo Atlas. Seem to be some limitations including migrations in comparison, I'm thinking I should specifically point these out in the docs. Maybe like a little section at the end. What do you think?
Yeah definitely, there's an open issue right now about migration support that you can link to, so Prisma is aware and is working on support.
Yeah definitely, there's an open issue right now about migration support that you can link to, so Prisma is aware and is working on support.
Thanks! @ajcwebdev I'll get on with it, then we can have a draft PR, then probably move to the production guide then finish with the testing section. How does that sound?
Yeah that sounds great, feel free to provide any pieces as they're ready to go and I will keep an eye out and provide notes 👍!
Word from the Prisma team is that migrations will not be supported in the near future, but you can use db push as a workaround for now.
Quick update on this front, I've got a guide now on Getting Started with MongoDB on Railway. I'm too much of a MongoDB noob to know why this is the case, but there's some important differences in what connection string you need to give the Prisma schema.
Atlas Version
Append connection string with ?retryWrites=true&w=majority.
mongodb+srv://ajcwebdev:<PASSWORD>@posts.5mngs.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
Railway Version
Append connection string with ?authSource=admin.
mongodb://mongo:<PASSWORD>@containers-us-west-1.railway.app:6852/test?authSource=admin
@thedavidprice and @dthyresson, given the current options what are your opinions on how to build out the cookbook in terms of the actual database deployment step? Should it include instructions for:
A. Only Atlas B. Only Railway C. Separate sections with instructions for each
MongoDB is now Generally Available as of Prisma v3.12.0 🥳 🎉
- To celebrate the release there will be a launch week later this month.
- Check out the blog announcement for more details.