In this scenario, I have a nested Document type that isn't a database indexed item.
Let's use Foo and Oof both needing access to the type of Bar.
file: schema.prisma
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = "{urlOmitted}"
}
generator nestjsDto {
provider = "prisma-generator-nestjs-dto"
output = "../src"
outputToNestJsResourceStructure = "true"
}
type Bar {
thing1 String
thing2 Int
thing3 Boolean
}
model Foo {
id String @id @default(auto()) @map("_id") @db.ObjectId
bar Bar
thing Int
}
model Oof {
id String @id @default(auto()) @map("_id") @db.ObjectId
bar Bar
thing String
}
Upon generation, an error is thrown Error: related model 'Bar' for 'Foo.bar' not found
npx prisma generate
Prisma schema loaded from prisma/schema.prisma
prisma:info Processing Model Foo
Error:
✔ Generated Prisma Client (3.14.0 | library) to ./node_modules/@prisma/client in 74ms
Error: related model 'Bar' for 'Foo.bar' not found
In this scenario, I have a nested Document type that isn't a database indexed item.
Let's use
Foo
andOof
both needing access to the type ofBar
.file: schema.prisma
Upon generation, an error is thrown
Error: related model 'Bar' for 'Foo.bar' not found