Skip to content

Commit d2f956a

Browse files
committed
chore: fixups
1 parent 6b90041 commit d2f956a

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

src/client-side-encryption/auto_encrypter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export class AutoEncrypter {
160160
_mongocrypt: MongoCrypt;
161161

162162
/**
163-
* @internal
164163
* Used by devtools to enable decorating decryption results.
165164
*
166165
* When set and enabled, `decrypt` will automatically recursively

src/connection_string.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,11 @@ export function parseOptions(
508508
);
509509
}
510510

511-
const loggerFeatureFlag = '__enableMongoLogger';
512-
mongoOptions[loggerFeatureFlag] = mongoOptions[loggerFeatureFlag] ?? false;
511+
mongoOptions.__enableMongoLogger = mongoOptions.__enableMongoLogger ?? false;
513512

514513
let loggerEnvOptions: MongoLoggerEnvOptions = {};
515514
let loggerClientOptions: MongoLoggerMongoClientOptions = {};
516-
if (mongoOptions[loggerFeatureFlag]) {
515+
if (mongoOptions.__enableMongoLogger) {
517516
loggerEnvOptions = {
518517
MONGODB_LOG_COMMAND: process.env.MONGODB_LOG_COMMAND,
519518
MONGODB_LOG_TOPOLOGY: process.env.MONGODB_LOG_TOPOLOGY,
@@ -523,7 +522,7 @@ export function parseOptions(
523522
MONGODB_LOG_ALL: process.env.MONGODB_LOG_ALL,
524523
MONGODB_LOG_MAX_DOCUMENT_LENGTH: process.env.MONGODB_LOG_MAX_DOCUMENT_LENGTH,
525524
MONGODB_LOG_PATH: process.env.MONGODB_LOG_PATH,
526-
...mongoOptions['__internalLoggerConfig']
525+
...mongoOptions.__internalLoggerConfig
527526
};
528527
loggerClientOptions = {
529528
mongodbLogPath: mongoOptions.mongodbLogPath,
@@ -1313,27 +1312,11 @@ export const OPTIONS = {
13131312
mongodbLogMaxDocumentLength: { type: 'uint' },
13141313
__enableMongoLogger: { type: 'boolean' },
13151314
__skipPingOnConnect: { type: 'boolean' },
1316-
__internalLoggerConfig: { type: 'any' }
1317-
} as Record<
1318-
keyof Omit<
1319-
MongoClientOptions,
1320-
'__enableMongoLogger' | '__internalLoggerConfig' | '__skipPingOnConnect'
1321-
>,
1322-
OptionDescriptor
1323-
>;
1315+
__internalLoggerConfig: { type: 'record' }
1316+
} as Record<keyof MongoClientOptions, OptionDescriptor>;
13241317

13251318
export const DEFAULT_OPTIONS = new CaseInsensitiveMap(
13261319
Object.entries(OPTIONS)
13271320
.filter(([, descriptor]) => descriptor.default != null)
13281321
.map(([k, d]) => [k, d.default])
13291322
);
1330-
1331-
/**
1332-
* Set of permitted feature flags
1333-
* @internal
1334-
*/
1335-
export const FEATURE_FLAGS = new Set([
1336-
'__skipPingOnConnect',
1337-
'__enableMongoLogger',
1338-
'__internalLoggerConfig'
1339-
]);

src/mongo_client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
type LogComponentSeveritiesClientOptions,
2727
type MongoDBLogWritable,
2828
MongoLogger,
29+
type MongoLoggerEnvOptions,
2930
type MongoLoggerOptions,
3031
SeverityLevel
3132
} from './mongo_logger';
@@ -301,7 +302,7 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
301302
/** @internal */
302303
__skipPingOnConnect?: boolean;
303304
/** @internal */
304-
__internalLoggerConfig?: any;
305+
__internalLoggerConfig?: MongoLoggerEnvOptions;
305306
/** @internal */
306307
__enableMongoLogger?: boolean;
307308
}

src/sdam/topology.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MongoCredentials } from '../cmap/auth/mongo_credentials';
33
import type { ConnectionEvents } from '../cmap/connection';
44
import type { ConnectionPoolEvents } from '../cmap/connection_pool';
55
import type { ClientMetadata } from '../cmap/handshake/client_metadata';
6-
import { DEFAULT_OPTIONS, FEATURE_FLAGS } from '../connection_string';
6+
import { DEFAULT_OPTIONS } from '../connection_string';
77
import {
88
CLOSE,
99
CONNECT,
@@ -251,8 +251,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
251251
// Options should only be undefined in tests, MongoClient will always have defined options
252252
options = options ?? {
253253
hosts: [HostAddress.fromString('localhost:27017')],
254-
...Object.fromEntries(DEFAULT_OPTIONS.entries()),
255-
...Object.fromEntries(FEATURE_FLAGS.entries())
254+
...Object.fromEntries(DEFAULT_OPTIONS.entries())
256255
};
257256

258257
if (typeof seeds === 'string') {

test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CapturingMongoClient extends MongoClient {
3434
commandStartedEvents: Array<CommandStartedEvent> = [];
3535
clientsCreated = 0;
3636
constructor(url: string, options: MongoClientOptions = {}) {
37-
options = { ...options, monitorCommands: true, [Symbol.for('@@mdb.skipPingOnConnect')]: true };
37+
options = { ...options, monitorCommands: true, __skipPingOnConnect: true };
3838
if (process.env.MONGODB_API_VERSION) {
3939
options.serverApi = process.env.MONGODB_API_VERSION as MongoClientOptions['serverApi'];
4040
}
@@ -102,7 +102,7 @@ const metadata = {
102102
topology: '!load-balanced'
103103
}
104104
};
105-
describe('Connection Pool Deadlock Prevention', function () {
105+
describe.only('Connection Pool Deadlock Prevention', function () {
106106
beforeEach(async function () {
107107
const url: string = this.configuration.url();
108108

0 commit comments

Comments
 (0)