prisma 已經支持mongodb了,咱們須要作的就是安裝新版本的prisma cli,後然初始化項目使用mongodb
注意使用新版本(prisma/1.32.2) 低版本有坑docker
npm install -g prisma
prisma init mongodb-demo ? Set up a new Prisma server or deploy to an existing server? Create new database ? What kind of database do you want to deploy to? MongoDB ? Select the programming language for the generated Prisma client Prisma JavaScript Client Created 3 new files: prisma.yml Prisma service definition datamodel.prisma GraphQL SDL-based datamodel (foundation for database) docker-compose.yml Docker configuration file Next steps: 1. Open folder: cd mongodb-demo 2. Start your Prisma server: docker-compose up -d 3. Deploy your Prisma service: prisma deploy 4. Read more about Prisma server: http://bit.ly/prisma-server-overview
prisma 項目使用docker-compose 運行npm
docker-compose up -d
prisma deploy
以上只是簡單的操做,同時還支持數據訂閱,仍是很方便,只是官方文檔就有點不是很好了測試
https://www.prisma.io/docs/prisma-cli-and-configuration/prisma-yml-5cy7/
https://www.prisma.io/docs/1.32/prisma-server/database-connector-MONGO-jgfm/code