MCPcopy
hub / github.com/mongodb/node-mongodb-native / pin

Method pin

src/sessions.ts:234–244  ·  view source on GitHub ↗

@internal

(conn: Connection)

Source from the content-addressed store, hash-verified

232
233 /** @internal */
234 pin(conn: Connection): void {
235 if (this.pinnedConnection) {
236 throw TypeError('Cannot pin multiple connections to the same session');
237 }
238
239 this.pinnedConnection = conn;
240 conn.emit(
241 PINNED,
242 this.inTransaction() ? ConnectionPoolMetrics.TXN : ConnectionPoolMetrics.CURSOR
243 );
244 }
245
246 /** @internal */
247 unpin(options?: { force?: boolean; forceClear?: boolean; error?: AnyError }): void {

Callers 1

commandMethod · 0.80

Calls 2

inTransactionMethod · 0.95
emitMethod · 0.65

Tested by

no test coverage detected