Skip to content

Upgrade the MongoDB driver dependency to ~7.8ย #16667

Closed

Description

@oscarmaia

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

  1. added
    new featureThis change adds new functionality, like a new method or class
    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature
    on Nov 2, 2026
  2. darshpatel1052 commented on Nov 3, 2026

    @darshpatel1052

    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?

  3. vkarpov15 commented on Nov 3, 2026

    @vkarpov15
    Collaborator

    No blocker. We will bump to MongoDB Node driver 7.8 when we release Mongoose 9.12 sometime within the next 24 hours.

  4. added this to the 9.12 milestone on Nov 3, 2026
  5. vkarpov15 commented on Nov 3, 2026

    @vkarpov15
    Collaborator

    PR to bump here: #16672

  6. added a commit that references this issue on Nov 3, 2026
  7. darshpatel1052 commented on Nov 4, 2026

    @darshpatel1052

    Alright, thanks for the update. Iโ€™ll avoid duplicating #16672.

  8. oscarmaia commented on Nov 4, 2026

    @oscarmaia
    Author

    Thanks for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new featurenew featureThis change adds new functionality, like a new method or class

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions