Skip to content

Conversation

durran
Copy link
Member

@durran durran commented Aug 28, 2025

Description

Exposes db and client in the public API.

What is changing?

  • collection.db exposes the Db object
  • db.client is now public and exposes the client.
Is there new documentation needed for these changes?

None

What is the motivation for this change?

NODE-7125

Release Highlight

Collection and Db objects now provide references to their Db and MongoClient

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI);
const db = client.db('test');
assert(db.client === client); // returns the MongoClient associated with the Db object
const collection = db.collection('test');
assert(collection.db === db); // returns the Db associated with the Collection object

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@durran durran marked this pull request as ready for review August 28, 2025 20:25
@durran durran requested a review from a team as a code owner August 28, 2025 20:25
@tadjik1 tadjik1 self-requested a review August 29, 2025 13:06
@tadjik1 tadjik1 self-assigned this Aug 29, 2025
@tadjik1 tadjik1 added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 29, 2025
tadjik1
tadjik1 previously approved these changes Aug 29, 2025
@tadjik1 tadjik1 removed their assignment Aug 29, 2025
@tadjik1 tadjik1 removed the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 29, 2025
@baileympearson baileympearson self-assigned this Aug 29, 2025
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 29, 2025
@baileympearson baileympearson merged commit 3469f86 into main Aug 29, 2025
28 of 29 checks passed
@baileympearson baileympearson deleted the NODE-7125 branch August 29, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants