[PR #3203] [MERGED] fix(create-adapter): doesn't work with mongoAdapter #4701

Closed
opened 2026-03-13 11:56:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3203
Author: @ping-maxwell
Created: 6/28/2025
Status: Merged
Merged: 6/28/2025
Merged by: @Bekacru

Base: mainHead: fix/create-adapter/with-mongo


📝 Commits (3)

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/adapters/create-adapter/index.ts (+2 -2)

📄 Description

In Better-auth, we do not allow customising IDs, so nothing takes into account of "different ids". However MongoDB requires ids to be different.

The getDefaultFieldName fn in the create-adapter doesn't take into account that IDs from Mongo are not the same as the normal id. This is a patch fix until proper resolve is implemented.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3203 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 6/28/2025 **Status:** ✅ Merged **Merged:** 6/28/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/create-adapter/with-mongo` --- ### 📝 Commits (3) - [`16de699`](https://github.com/better-auth/better-auth/commit/16de699426974991e76ef93866fca7b6676860eb) fix(create-adapter): doesn't work with monogAdapter - [`8cd60d4`](https://github.com/better-auth/better-auth/commit/8cd60d463de8fb46f7cf23d4c0fc3cbcc872d0dc) chore: lint - [`8f8290c`](https://github.com/better-auth/better-auth/commit/8f8290c6260578198db1a92303daf3b36c6fc8bb) chore: cleanup ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/create-adapter/index.ts` (+2 -2) </details> ### 📄 Description In Better-auth, we do not allow customising IDs, so nothing takes into account of "different ids". However MongoDB requires ids to be different. The `getDefaultFieldName` fn in the create-adapter doesn't take into account that IDs from Mongo are not the same as the normal `id`. This is a patch fix until proper resolve is implemented. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:56:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4701