Alf Fenton
04/15/2022, 2:02 PMmodel User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
description String?
name String?
username String?
password String?
followedBy User[] @relation("UserFollows", fields: [followedByIDs], references: [id])
followedByIDs String[] @db.ObjectId
following User[] @relation("UserFollows", fields: [followingIDs], references: [id])
followingIDs String[] @db.ObjectId
role Role @default(USER)
reivews Review[]
emailVerified DateTime? @map("email_verified")
image String?
accounts Account[]
sessions Session[]
@@fulltext([name(sort: Desc), username, email])
@@map("users")
}
When attempting to match/connect two existing users through the following relations with the use of Prisma client code:
await prisma.user.update({
where:{
email:'<mailto:alf@votaryfilms.com|alf@votaryfilms.com>'
},
data:{
following: {connect: [{id: data}]}
}
})
I get the following error:
The current database provider doesn't support a feature that the query used: Unhandled and unsupported value
mapping for MongoDB: 6223c13a26bb3d44fc98dad5 as Int.
If possible, could someone help point out where I'm wrong in my approach, if this is a bug perhaps, or if there are better-known ways for me to achieve the above goal?
Thanks so much 🙏janpio