Repository navigation
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
๐ Feature Proposal
Would you consider upgrading the MongoDB driver dependency from ~7.7 to ~7.8?
Is there any know blocker to this upgrade? and would a PR be welcome?
Motivation
I use Mongoose with Better Auth and pass Mongoose's underlying database instance to Better Auth's MongoDB adapter.
My installed dependencies include:
- mongoose@9.11.4 โ mongodb@7.7.0
- better-auth@1.7.12 โ mongodb@7.8.0
- @better-auth/mongo-adapter@1.7.12 โ mongodb@7.8.0
Sharing the database instance causes a TypeScript error because the two installed driver versions have incompatible types:
Argument of type 'import(".../mongoose/node_modules/mongodb/mongodb").Db'
is not assignable to parameter of type 'import(".../node_modules/mongodb/mongodb").Db'.
Types have separate declarations of a private property 'driverInfoList'.
I found #14653, which describes a similar conflict with older driver versions.
I understand that aligning my application's dependencies on mongodb@7.7.0 is a workaround. This is a request to upgrade the supported driver version. I have not yet tested Mongoose against driver 7.8.
Example
After connecting Mongoose, I pass its database instance to the adapter:
import mongoose from 'mongoose';
import { mongodbAdapter } from 'better-auth/adapters/mongodb';
const db = mongoose.connection.db;
if (!db) throw new Error('Connect Mongoose first');
const adapter = mongodbAdapter(db);Using ~7.8 would allow Mongoose and Better Auth to share mongodb@7.8.0 after deduplication.
Activity
darshpatel1052 commentedon Nov 3, 2026
Hi, Iโd like to take this on. Iโd check the driver 7.8 changes against Mongooseโs integration and type tests, update the supported dependency range if compatible, and add a small type check for sharing the Db instance with Better Auth after deduplication. Are there known driver regressions or release constraints I should account for?
vkarpov15 commentedon Nov 3, 2026
No blocker. We will bump to MongoDB Node driver 7.8 when we release Mongoose 9.12 sometime within the next 24 hours.
vkarpov15 commentedon Nov 3, 2026
PR to bump here: #16672
Merge pull request #16672 from Automattic/vkarpov15/20261103/gh-16667
darshpatel1052 commentedon Nov 4, 2026
Alright, thanks for the update. Iโll avoid duplicating #16672.
oscarmaia commentedon Nov 4, 2026
Thanks for the update