Using mongodb adapter and generateId creates id field in addition to _id field

using this config:
import { createId } from '@paralleldrive/cuid2'

const auth = betterAuth({
  // ...
  database: mongodbAdapter(client.db()),
  advanced: {
    generateId: () => return createId()
  }
})


leads to user documents having the following form:
// user
{
  "_id": ObjectId('67dee48723670eccd7f45380'),
  "id": "g966fyld09zcrhbq7v6wiib1",
  "name": " ... ",
  // ...
}

This seems to be intended behavior, but I would like to be able to override _id entirely. Is this possible?
Was this page helpful?