I'm trying to create an auto increment ID with Prisma, but the autoincrement() function doesn't exist with mongodb as data-source.
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
sequence Int @unique @default(autoincrement()) // This doesn't work with mongodb
email String @unique
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
I know I can make a query to check the last sequence but this seens to be too expensive to do.
There is a better way to this?
Like in prisma.user.create() there is a way to get the last sequence field (like we do with mongoose)?