Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 70a7d94

Browse files
authored
fix(uri_parser): restore original compression parsing
1 parent c067dbc commit 70a7d94

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/uri_parser.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ function applyConnectionStringOption(obj, key, value, options) {
264264
throw new MongoParseError('zlibCompressionLevel must be an integer between -1 and 9');
265265
}
266266

267+
// special cases
268+
if (key === 'compressors' || key === 'zlibcompressionlevel') {
269+
obj.compression = obj.compression || {};
270+
obj = obj.compression;
271+
}
272+
267273
if (key === 'authmechanismproperties') {
268274
if (typeof value.SERVICE_NAME === 'string') obj.gssapiServiceName = value.SERVICE_NAME;
269275
if (typeof value.SERVICE_REALM === 'string') obj.gssapiServiceRealm = value.SERVICE_REALM;

test/tests/unit/connection_string_tests.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,11 @@ describe('Connection String', function() {
100100
'mongodb://localhost/?compressors=zlib&zlibCompressionLevel=4',
101101
(err, result) => {
102102
expect(err).to.not.exist;
103-
expect(result.options.compressors).to.eql(['zlib']);
104-
expect(result.options.zlibCompressionLevel).to.equal(4);
103+
expect(result.options).to.have.property('compression');
104+
expect(result.options.compression).to.eql({
105+
compressors: ['zlib'],
106+
zlibCompressionLevel: 4
107+
});
105108

106109
done();
107110
}

0 commit comments

Comments
 (0)