Skip to content

Commit 50d6bd1

Browse files
author
Thomas Reggi
committed
testing sharded topology
1 parent 4955a52 commit 50d6bd1

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

lib/core/uri_parser.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -687,15 +687,6 @@ function parseConnectionString(uri, options, callback) {
687687
return callback(new MongoParseError('directConnection option requires exactly one host'));
688688
}
689689

690-
// NOTE: this behavior will go away in v4.0, we will always auto discover there
691-
if (
692-
parsedOptions.directConnection == null &&
693-
hosts.length === 1 &&
694-
parsedOptions.replicaSet == null
695-
) {
696-
parsedOptions.directConnection = true;
697-
}
698-
699690
const result = {
700691
hosts: hosts,
701692
auth: auth.db || auth.username ? auth : null,

test/functional/sharding_connection.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
'use strict';
22

3+
const withClient = require('./shared').withClient;
34
const setupDatabase = require('./shared').setupDatabase;
45
const expect = require('chai').expect;
6+
const TopologyType = require('../../lib/core/sdam/common').TopologyType;
57

68
describe('Sharding (Connection)', function() {
79
before(function() {
810
return setupDatabase(this.configuration);
911
});
1012

13+
it.only('Should use sharded topology', {
14+
metadata: { requires: { topology: 'sharded' } },
15+
test: function() {
16+
const client = this.configuration.newClient({}, { useUnifiedTopology: true });
17+
expect(client.s.options).to.have.property('useUnifiedTopology', true);
18+
return withClient(client, (client, done) => {
19+
expect(client).to.exist;
20+
expect(client.topology).to.exist;
21+
expect(client.topology.description).to.exist;
22+
expect(client.topology.description).to.have.property('type', TopologyType.Sharded);
23+
return done();
24+
})();
25+
}
26+
});
27+
1128
/**
1229
* @ignore
1330
*/

0 commit comments

Comments
 (0)