File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -172,11 +172,17 @@ export class Collection<TSchema extends Document = Document> {
172
172
/** @internal */
173
173
client : MongoClient ;
174
174
175
+ /**
176
+ * Get the database object for the collection.
177
+ */
178
+ readonly db : Db ;
179
+
175
180
/**
176
181
* Create a new Collection instance
177
182
* @internal
178
183
*/
179
184
constructor ( db : Db , name : string , options ?: CollectionOptions ) {
185
+ this . db = db ;
180
186
// Internal state
181
187
this . s = {
182
188
db,
@@ -192,13 +198,6 @@ export class Collection<TSchema extends Document = Document> {
192
198
this . client = db . client ;
193
199
}
194
200
195
- /**
196
- * Get the database object for the collection.
197
- */
198
- get db ( ) : Db {
199
- return this . s . db ;
200
- }
201
-
202
201
/**
203
202
* The name of the database this collection belongs to
204
203
*/
Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ export class Db {
126
126
/** @internal */
127
127
s : DbPrivate ;
128
128
129
- /** @public */
129
+ /**
130
+ * Gets the MongoClient associated with the Db.
131
+ * @public
132
+ */
130
133
readonly client : MongoClient ;
131
134
132
135
public static SYSTEM_NAMESPACE_COLLECTION = CONSTANTS . SYSTEM_NAMESPACE_COLLECTION ;
You can’t perform that action at this time.
0 commit comments