I want to query by using where in object with prisma and mongo Here is my prisma schema
model Member {
id String @id @default(auto()) @map("_id") @db.ObjectId
bank BankInfo
@@map("members")
}
type BankInfo {
bankNo String
}
const member = await this.prisma.member.findFirst({
where: { bank: { bankNo: 'test' } },
});
I got an error
Error:
Invalid prisma.member.findFirst()
invocation:
You can try to use equal operator ($eq) like that :
const member = await this.db.member.find({
bank: { $eq: { bankNo: 'test' } }
})