skills/prisma-database-setup-mongodb/SKILL.md
MongoDB Setup. Reference when using this Prisma feature.
npx skillsauth add prisma/cursor-plugin prisma-database-setup-mongodbInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
⚠️ 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:[email protected]/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.
databases
Schema Changes. Reference when using this Prisma feature.
tools
Removed Features. Reference when using this Prisma feature.
tools
Prisma Config. Reference when using this Prisma feature.
tools
ESM Support. Reference when using this Prisma feature.