hey, everyone. i'm trying to work out how to use ...
# orm-help
j
hey, everyone. i'm trying to work out how to use many to many relationships with prisma / mongodb and ran into a small issue. here is my schema:
model Guild {
id      String   @id @default(auto()) @map("_id") @db.ObjectId
guildId String   @unique
modules Modules
users   Member[]
}
model Member {
id       String   @id @default(auto()) @map("_id") @db.ObjectId
rblxId   Int      @default(0)
xp       Int      @default(0)
userId   String   @default("0")
medalIDs String[] @db.ObjectId
medals   Medal[]  @relation(fields: [medalIDs], references: [id])
guildId  String
Guild    Guild    @relation(fields: [guildId], references: [id])
}
1
how would i query the Member model `Prisma.member.findMany`for all records that contain a specific
guildId
? and by that, i mean the string defined in the schema in both models. when i try to query it, it somehow errors and is defined as an object id.
n
Hey @Jake W, Just to confirm, is this also sorted now?
j
i added a new string field without a relation which i use to query. it now works but is there any better solution?
n
@Jake W Do let me know in case you have any other queries or follow up questions.