1

In Prisma For MongogDB quick start guide, they wrote something like the following

datasource db {
provider = "mongodb"
url      = env("DATABASE_URL")
}

My question is what is "db" right after "datasource" keyword?

Abir Sheikh
  • 463
  • 4
  • 9

1 Answers1

1

The value db is tied to the name of the datasource in your schema file.

datasource db is a convention - however, you can give your data source any name - for example, datasource mysql or datasource data.

Here's a reference for datasource which should be helpful.

In your schema file when using native database types you need to refer to the datasource name which is defined. So if your datasource is defined as data you would refer the native type as @data.String instead of conventional @db.String

Nurul Sundarani
  • 5,550
  • 3
  • 23
  • 52