npx skills add ...
npx skills add prisma/cursor-plugin --skill prisma-database-setup-mongodb
npx skills add prisma/cursor-plugin --skill prisma-database-setup-mongodb
MongoDB Setup. Reference when using this Prisma feature.
⚠️ 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:
MongoDB models must have a mapped _id field using @id and @map("_id"), usually of type String with auto() and db.ObjectId.
Relations in MongoDB expect IDs to be db.ObjectId type.
In .env:
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.
model Post {
id String @id @default(auto()) @map("_id") @db.ObjectId
author User @relation(fields: [authorId], references: [id])
authorId String @db.ObjectId
}DATABASE_URL="mongodb+srv://user:password@cluster.mongodb.net/mydb?retryWrites=true&w=majority"