Hello, everyone at Prisma. Thanks for allowing a d...
# orm-help
a
Hello, everyone at Prisma. Thanks for allowing a direct audience with your team through slack. I'm a developer working on a startup project using prisma, nextjs, and MongoDB; and in this project, I have a many to many self relational database models for my users. (seen below)
Copy code
model 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:
Copy code
await prisma.user.update({
            where:{
                email:'<mailto:alf@votaryfilms.com|alf@votaryfilms.com>'
            },
            data:{
                following: {connect: [{id: data}]}
            }
        })
I get the following error:
Copy code
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 🙏
j
On a quick look, this indeed looks like it should work. Can you please open a bug report issue? Then we can take a deeper look. Thanks.