Skip to content

Commit

Permalink
fix(mongodb+srv): respect overriding SRV-provided properties
Browse files Browse the repository at this point in the history
This PR fixes the spec test and corrects the behavior of the TXT record
overriding the querystring by reversing the merge.

NODE-2335
  • Loading branch information
mpilar authored and mbroadst committed Nov 18, 2019
1 parent 4f83a13 commit ea83360
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/uri_parser.js
Expand Up @@ -100,7 +100,7 @@ function parseSrvConnectionString(uri, options, callback) {
);
}

Object.assign(result.query, record);
result.query = Object.assign({}, record, result.query);
}

// Set completed options back into the URL object.
Expand Down
4 changes: 4 additions & 0 deletions test/core/unit/mongodb_srv_tests.js
Expand Up @@ -45,6 +45,10 @@ describe('mongodb+srv', function() {
expect(result.options.ssl).to.equal(test[1].options.ssl);
}

if (test[1].options && test[1].options.authSource) {
expect(result.options.authsource).to.equal(test[1].options.authSource);
}

if (
test[1].parsed_options &&
test[1].parsed_options.user &&
Expand Down

0 comments on commit ea83360

Please sign in to comment.