(url: string, options?: MongoClientOptions)
| 434 | private driverInfoList: DriverInfo[] = []; |
| 435 | |
| 436 | constructor(url: string, options?: MongoClientOptions) { |
| 437 | super(); |
| 438 | this.on('error', noop); |
| 439 | |
| 440 | this.options = parseOptions(url, this, options); |
| 441 | |
| 442 | this.appendMetadata(this.options.driverInfo); |
| 443 | |
| 444 | const shouldSetLogger = Object.values(this.options.mongoLoggerOptions.componentSeverities).some( |
| 445 | value => value !== SeverityLevel.OFF |
| 446 | ); |
| 447 | this.mongoLogger = shouldSetLogger |
| 448 | ? new MongoLogger(this.options.mongoLoggerOptions) |
| 449 | : undefined; |
| 450 | |
| 451 | // eslint-disable-next-line @typescript-eslint/no-this-alias |
| 452 | const client = this; |
| 453 | |
| 454 | // The internal state |
| 455 | this.s = { |
| 456 | url, |
| 457 | bsonOptions: resolveBSONOptions(this.options), |
| 458 | namespace: ns('admin'), |
| 459 | hasBeenClosed: false, |
| 460 | sessionPool: new ServerSessionPool(this), |
| 461 | activeSessions: new Set(), |
| 462 | activeCursors: new Set(), |
| 463 | authProviders: new MongoClientAuthProviders(), |
| 464 | |
| 465 | get options() { |
| 466 | return client.options; |
| 467 | }, |
| 468 | get readConcern() { |
| 469 | return client.options.readConcern; |
| 470 | }, |
| 471 | get writeConcern() { |
| 472 | return client.options.writeConcern; |
| 473 | }, |
| 474 | get readPreference() { |
| 475 | return client.options.readPreference; |
| 476 | }, |
| 477 | get isMongoClient(): true { |
| 478 | return true; |
| 479 | } |
| 480 | }; |
| 481 | this.checkForNonGenuineHosts(); |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * An alias for {@link MongoClient.close|MongoClient.close()}. |
nothing calls this directly
no test coverage detected