File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -469,8 +469,16 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
469
469
selectServerOptions
470
470
) ;
471
471
472
- const connection = await server . pool . checkOut ( { timeoutContext : timeoutContext } ) ;
473
- server . pool . checkIn ( connection ) ;
472
+ const skipPingOnConnect = this . s . options . __skipPingOnConnect === true ;
473
+ if ( ! skipPingOnConnect && this . s . credentials ) {
474
+ const connection = await server . pool . checkOut ( { timeoutContext : timeoutContext } ) ;
475
+ server . pool . checkIn ( connection ) ;
476
+ stateTransition ( this , STATE_CONNECTED ) ;
477
+ this . emit ( Topology . OPEN , this ) ;
478
+ this . emit ( Topology . CONNECT , this ) ;
479
+
480
+ return this ;
481
+ }
474
482
475
483
stateTransition ( this , STATE_CONNECTED ) ;
476
484
this . emit ( Topology . OPEN , this ) ;
You can’t perform that action at this time.
0 commit comments