Skip to content

Commit

Permalink
fix test and add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum committed Jan 27, 2021
1 parent 8be5302 commit 41677c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/core/uri_parser.js
Expand Up @@ -693,6 +693,10 @@ function parseConnectionString(uri, options, callback) {
hosts.length === 1 &&
parsedOptions.replicaSet == null
) {
console.warn(
'Automatic direct connection to single hosts is deprecated, please provide the `replicaSet` option' +
' or explicitly set the `directConnection` option'
);
parsedOptions.directConnection = true;
}

Expand Down
6 changes: 5 additions & 1 deletion test/functional/sharding_connection.test.js
Expand Up @@ -13,7 +13,11 @@ describe('Sharding (Connection)', function() {
it('Should use sharded topology', {
metadata: { requires: { topology: 'sharded' } },
test: function() {
const client = this.configuration.newClient({}, { useUnifiedTopology: true });
const client = this.configuration.newClient(
{},
// note: directConnection: false will be the default behavior in 4.0
{ useUnifiedTopology: true, directConnection: false }
);
return withClient(client, (client, done) => {
expect(client).to.exist;
expect(client)
Expand Down

0 comments on commit 41677c4

Please sign in to comment.