Skip to content

Commit 3e2ef86

Browse files
committed
chore: keep option
1 parent a6ff574 commit 3e2ef86

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/sdam/topology.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)