Skip to content

Commit 5ed4c07

Browse files
mpilarmbroadst
authored andcommitted
fix(mongodb+srv): respect overriding SRV-provided properties
This PR fixes the spec test and corrects the behavior of the TXT record overriding the querystring by reversing the merge. NODE-2335
1 parent 08ee53e commit 5ed4c07

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/core/uri_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function parseSrvConnectionString(uri, options, callback) {
100100
);
101101
}
102102

103-
Object.assign(result.query, record);
103+
result.query = Object.assign({}, record, result.query);
104104
}
105105

106106
// Set completed options back into the URL object.

test/core/unit/mongodb_srv_tests.js

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ describe('mongodb+srv', function() {
4545
expect(result.options.ssl).to.equal(test[1].options.ssl);
4646
}
4747

48+
if (test[1].options && test[1].options.authSource) {
49+
expect(result.options.authsource).to.equal(test[1].options.authSource);
50+
}
51+
4852
if (
4953
test[1].parsed_options &&
5054
test[1].parsed_options.user &&

0 commit comments

Comments
 (0)