Back to Browse

MongoDB + Blitz.js - Working setup in 10mins

2.1K views
Nov 17, 2021
10:21

To setup MongoDB with Blitz.js and Prisma is not so clear and straighforward as one would hope. We did some digging and managed to get it working. This is how! Step 1 - Setup scheme.prisma file correctly Link - https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/mongodb/introspection-typescript-mongodb/ Step 2 - Run MongoDB correctly Link - https://docs.mongodb.com/manual/tutorial/convert-standalone-to-replica-set/ Step 3 - Create collections for all models Link - https://stackoverflow.com/questions/52585715/cannot-create-namespace-in-multi-document-transactionmongodb-4-0-spring-data-2 0:00 Video Intro 0:24 Channel Intro 0:28 Tutorial approach 0:55 Blitz project view in VSCode 1:12 Config schema.prisma with previewFeatures for MongoDB 1:48 schema.prisma fake fix 2:18 Database URL Environment Variable 2:49 Failed attempt to connect to mongo localhost 3:05 Run Mongod normally 3:30 Successful attempt to connect to mongo localhost 3:48 Run blitz prisma generate 4:15 Test 4:28 Error 1 5:27 Fix 1 - Run Mongod correctly 6:22 Initialize Replica Set in Mongo Shell 6:40 Error 2 7:05 Fix 2 - Create namespaces/mongo collections 7:32 Error 3 8:05 Fix 3 - Update schema.prisma again 9:04 It works! 9:27 Step 1 Summary 9:40 Step 2 Summary 10:00 Step 3 Summary

Download

0 formats

No download links available.

MongoDB + Blitz.js - Working setup in 10mins | NatokHD