File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -172,8 +172,8 @@ export class Db implements OperationParent {
172
172
logger : new Logger ( 'Db' , options ) ,
173
173
// Unpack read preference
174
174
readPreference : ReadPreference . fromOptions ( options ) ,
175
- // Merge bson options TODO: include client bson options, after NODE-2850
176
- bsonOptions : resolveBSONOptions ( options ) ,
175
+ // Merge bson options
176
+ bsonOptions : resolveBSONOptions ( options , client ) ,
177
177
// Set up the primary key factory or fallback to ObjectId
178
178
pkFactory : options ?. pkFactory ?? {
179
179
createPk ( ) {
@@ -208,14 +208,17 @@ export class Db implements OperationParent {
208
208
return this . s . readPreference ?. preference !== 'primary' || false ;
209
209
}
210
210
211
+ /**
212
+ * The current readPreference of the Db. If not explicitly defined for
213
+ * this Db, will be inherited from the parent MongoClient
214
+ */
211
215
get readConcern ( ) : ReadConcern | undefined {
212
216
return this . s . readConcern ;
213
217
}
214
218
215
219
get readPreference ( ) : ReadPreference {
216
220
if ( this . s . readPreference == null ) {
217
- // TODO: check client
218
- return ReadPreference . primary ;
221
+ return this . s . client . readPreference ;
219
222
}
220
223
221
224
return this . s . readPreference ;
You can’t perform that action at this time.
0 commit comments