Skip to content

Commit 41677c4

Browse files
committed
fix test and add deprecation warning
1 parent 8be5302 commit 41677c4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/core/uri_parser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ function parseConnectionString(uri, options, callback) {
693693
hosts.length === 1 &&
694694
parsedOptions.replicaSet == null
695695
) {
696+
console.warn(
697+
'Automatic direct connection to single hosts is deprecated, please provide the `replicaSet` option' +
698+
' or explicitly set the `directConnection` option'
699+
);
696700
parsedOptions.directConnection = true;
697701
}
698702

test/functional/sharding_connection.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ describe('Sharding (Connection)', function() {
1313
it('Should use sharded topology', {
1414
metadata: { requires: { topology: 'sharded' } },
1515
test: function() {
16-
const client = this.configuration.newClient({}, { useUnifiedTopology: true });
16+
const client = this.configuration.newClient(
17+
{},
18+
// note: directConnection: false will be the default behavior in 4.0
19+
{ useUnifiedTopology: true, directConnection: false }
20+
);
1721
return withClient(client, (client, done) => {
1822
expect(client).to.exist;
1923
expect(client)

0 commit comments

Comments
 (0)