[PR #6139] [MERGED] fix(mongodb): mongodb findOneAndUpdate should return .value #32075

Closed
opened 2026-04-17 22:56:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6139
Author: @Paola3stefania
Created: 11/20/2025
Status: Merged
Merged: 11/21/2025
Merged by: @Bekacru

Base: canaryHead: fix/mongo-adapter


📝 Commits (6)

  • fa90220 fix: return the updated model or null
  • e4e60d4 Merge branch 'canary' into fix/mongo-adapter
  • 1bce3f1 Merge branch 'canary' into fix/mongo-adapter
  • c479cf7 fix(mongodb-adapter): extract value from findOneAndUpdate result in update method
  • 765d21e Merge branch 'canary' into fix/mongo-adapter
  • 2dc1bae Merge branch 'canary' into fix/mongo-adapter

📊 Changes

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

View changed files

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

📄 Description

Closes #6124

Summary by cubic

Fix MongoDB adapter to return the updated model or null from findOneAndUpdate. This avoids returning the driver’s result wrapper and correctly returns null when no document is matched.

Written for commit 2dc1baed07. 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/6139 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 11/20/2025 **Status:** ✅ Merged **Merged:** 11/21/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/mongo-adapter` --- ### 📝 Commits (6) - [`fa90220`](https://github.com/better-auth/better-auth/commit/fa902206aee841d4773f754ad603ce70c61fe044) fix: return the updated model or null - [`e4e60d4`](https://github.com/better-auth/better-auth/commit/e4e60d4b5adef37e1e56495100255eee084e40eb) Merge branch 'canary' into fix/mongo-adapter - [`1bce3f1`](https://github.com/better-auth/better-auth/commit/1bce3f1fe2ff6ecace036f18e7bd41a96379524a) Merge branch 'canary' into fix/mongo-adapter - [`c479cf7`](https://github.com/better-auth/better-auth/commit/c479cf7acf5a7d8204d27dda5722faa549dcd047) fix(mongodb-adapter): extract value from findOneAndUpdate result in update method - [`765d21e`](https://github.com/better-auth/better-auth/commit/765d21eace9f9a293260dd74c297747148d619c0) Merge branch 'canary' into fix/mongo-adapter - [`2dc1bae`](https://github.com/better-auth/better-auth/commit/2dc1baed0773899341a11a36177168c2d3c84348) Merge branch 'canary' into fix/mongo-adapter ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts` (+4 -2) </details> ### 📄 Description Closes [#6124](https://github.com/better-auth/better-auth/issues/6124) <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fix MongoDB adapter to return the updated model or null from findOneAndUpdate. This avoids returning the driver’s result wrapper and correctly returns null when no document is matched. <sup>Written for commit 2dc1baed0773899341a11a36177168c2d3c84348. 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-17 22:56:22 -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#32075