[PR #6033] [MERGED] fix: preserve provided string IDs in the MongoDB adapter when they are not valid ObjectId #14645

Closed
opened 2026-04-13 09:33:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6033
Author: @udnes99
Created: 11/17/2025
Status: Merged
Merged: 11/17/2025
Merged by: @Bekacru

Base: canaryHead: support-non-object-custom-id


📝 Commits (1)

  • 9d069b6 Support provided non-object string ids.

📊 Changes

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

View changed files

📝 packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts (+1 -1)

📄 Description


Summary by cubic

Preserve provided string IDs in the MongoDB adapter when they are not valid ObjectId, instead of generating a new ObjectId. This allows custom non-ObjectId identifiers to be stored and retrieved consistently.

Written for commit 9d069b66cd. Summary will update automatically on new commits.


🔄 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/6033 **Author:** [@udnes99](https://github.com/udnes99) **Created:** 11/17/2025 **Status:** ✅ Merged **Merged:** 11/17/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `support-non-object-custom-id` --- ### 📝 Commits (1) - [`9d069b6`](https://github.com/better-auth/better-auth/commit/9d069b66cd8e55456214b7ab912ef042e1ce8473) Support provided non-object string ids. ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts` (+1 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Preserve provided string IDs in the MongoDB adapter when they are not valid ObjectId, instead of generating a new ObjectId. This allows custom non-ObjectId identifiers to be stored and retrieved consistently. <sup>Written for commit 9d069b66cd8e55456214b7ab912ef042e1ce8473. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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-04-13 09:33:45 -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#14645