Last active
October 2, 2024 14:28
-
-
Save potikanond/ac536b98821696f816429db7bf8d6201 to your computer and use it in GitHub Desktop.
261207 - Lecture 21 - Prisma schema sample for MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is your Prisma schema file, | |
// learn more about it in the docs: https://pris.ly/d/prisma-schema | |
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? | |
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init | |
generator client { | |
provider = "prisma-client-js" | |
} | |
datasource db { | |
provider = "mongodb" | |
url = env("DATABASE_URL") | |
} | |
// define Course model | |
model Course { | |
// id is mapped to _id and managed by mongodb | |
id String @id @default(auto()) @map("_id") @db.ObjectId | |
courseNo String @unique | |
title String @unique | |
// collection name | |
@@map("courses") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment