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> {
469469 selectServerOptions
470470 ) ;
471471
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+ }
474482
475483 stateTransition ( this , STATE_CONNECTED ) ;
476484 this . emit ( Topology . OPEN , this ) ;
You can’t perform that action at this time.
0 commit comments