Skip to content

Commit 57659aa

Browse files
committed
feat(NODE-4559): add mongodb-legacy metadata
1 parent a539ec3 commit 57659aa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/legacy_wrappers/mongo_client.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ Object.defineProperty(module.exports, '__esModule', { value: true });
77

88
module.exports.makeLegacyMongoClient = function (baseClass) {
99
class LegacyMongoClient extends baseClass {
10+
// constructor adds client metadata before constructing final client
11+
constructor(connectionString, options) {
12+
options = { ...options };
13+
if (options.driverInfo != null && typeof options.driverInfo.name === 'string') {
14+
options.driverInfo.name += '|mongodb-legacy';
15+
} else {
16+
options.driverInfo = { name: 'mongodb-legacy' };
17+
}
18+
19+
super(connectionString, options);
20+
}
21+
1022
static connect(url, options, callback) {
1123
callback =
1224
typeof callback === 'function'

0 commit comments

Comments
 (0)