원클릭으로
prisma-database-setup-mongodb
MongoDB Setup. Reference when using this Prisma feature.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
MongoDB Setup. Reference when using this Prisma feature.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
prisma db execute. Reference when using this Prisma feature.
prisma db pull. Reference when using this Prisma feature.
prisma db push. Reference when using this Prisma feature.
prisma db seed. Reference when using this Prisma feature.
prisma debug. Reference when using this Prisma feature.
prisma dev. Reference when using this Prisma feature.
| name | prisma-database-setup-mongodb |
| description | MongoDB Setup. Reference when using this Prisma feature. |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
⚠️ WARNING: MongoDB is NOT supported in Prisma ORM v7.
Support for MongoDB is planned for a future v7 release. If you need MongoDB, you must use Prisma ORM v6.
In prisma/schema.prisma:
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
MongoDB models must have a mapped _id field using @id and @map("_id"), usually of type String with auto() and db.ObjectId.
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
name String?
}
Relations in MongoDB expect IDs to be db.ObjectId type.
model Post {
id String @id @default(auto()) @map("_id") @db.ObjectId
author User @relation(fields: [authorId], references: [id])
authorId String @db.ObjectId
}
In .env:
DATABASE_URL="mongodb+srv://user:password@cluster.mongodb.net/mydb?retryWrites=true&w=majority"
prisma migrate commands do not work.prisma db push to sync indexes and constraints.prisma db pull to generate schema from existing data (sampling).Ensure your MongoDB instance is a Replica Set. Standalone instances do not support transactions. Atlas clusters are replica sets by default.
Ensure fields referencing IDs are decorated with @db.ObjectId if the target is an ObjectID.