I have 2 tables:
model Collection {
id String @id @default(uuid()) @db.Uuid/
floorPrices CollectionFloorPrice[]
}
model CollectionFloorPrice {
id String @id @default(uuid()) @db.Uuid
collection Collection @relation(fields: [collectionId], references: [id])
collectionId String @db.Uuid
}
How do I query collections that only have rows present in CollectionFloorPrice
? In SQL it would be a simple JOIN.
This isn’t working:
return await this.prisma.collection.findMany({
where: {
floorPrices: {
exists: true,
},
},
});