findOneAndUpdate in mongodbAdapter returns inconsistent result shape

Hello, first of all I want to say that I love the framework. As the result I've have been migrating to it, but I encountered the following issue. I have also created github issue (https://github.com/better-auth/better-auth/issues/2508). There are more info in the page. Hi, I'm encountering an inconsistency with db.collection.findOneAndUpdate() in the mongodbAdapter. For some collections, it returns the updated document as expected. However, for others—like the users collection—it returns a result object in the following shape: { lastErrorObject: {n:1, updatedExisting: true} value: { //updated document } ok: 1 } Since the transform.transformOutput() function expects the updated document directly, this is causing a bug in my case. To be honest, I’m not entirely sure whether this is a bug in Better Auth or a quirk of the MongoDB Node.js driver.
GitHub
Issues · better-auth/better-auth
The most comprehensive authentication framework for TypeScript - Issues · better-auth/better-auth
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?