Skip to content

Commit e461f17

Browse files
committed
feat(NODE-7125): expose db and client
1 parent 4a6447c commit e461f17

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/collection.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ export class Collection<TSchema extends Document = Document> {
192192
this.client = db.client;
193193
}
194194

195+
/**
196+
* Get the database object for the collection.
197+
*/
198+
get db(): Db {
199+
return this.s.db;
200+
}
201+
195202
/**
196203
* The name of the database this collection belongs to
197204
*/

src/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class Db {
126126
/** @internal */
127127
s: DbPrivate;
128128

129-
/** @internal */
129+
/** @public */
130130
readonly client: MongoClient;
131131

132132
public static SYSTEM_NAMESPACE_COLLECTION = CONSTANTS.SYSTEM_NAMESPACE_COLLECTION;

0 commit comments

Comments
 (0)