Anyone know why i can't get this unique working? I...
# orm-help
r
Anyone know why i can't get this unique working? I can create multiple instances of the same slug.
Copy code
model Instructor {
  id                  String  @id @default(dbgenerated()) @map("_id") @db.ObjectId
  slug                String  @unique
}

const instructorSlug = slug(instructorInput.name);

await this._dbClient.instructor.create({
  data: {
    slug: instructorSlug,
  }
}
r
@Rene Nielsen 👋 We don’t support adding unique constraints directly on Mongo as of now, so you would manually have to add this on the database.
r
Ah okay, just didnt appear in the https://www.prisma.io/docs/concepts/database-connectors/mongodb#known-limitations But cool, i will do that. 🙂 Thanks for quick answer
👍 1
r
It would technically be covered in this point:
 The Migrate and Introspection workflows are currently not supported.
r
My bad! 🙂 I was prolly to novice to understand that part!