File tree Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,11 @@ class Topology extends EventEmitter {
131
131
if ( options [ optionName ] ) {
132
132
emitDeprecationWarning (
133
133
`The option \`${ optionName } \` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6` ,
134
- 'DeprecationWarning'
135
134
) ;
136
135
}
137
136
} ) ;
138
137
139
- const topologyType = topologyTypeFromSeedlist ( seedlist , options ) ;
138
+ const topologyType = topologyTypeFromSeedlist ( options ) ;
140
139
const topologyId = globalTopologyCounter ++ ;
141
140
const serverDescriptions = seedlist . reduce ( ( result , seed ) => {
142
141
if ( seed . domain_socket ) seed . host = seed . domain_socket ;
@@ -797,7 +796,7 @@ function parseStringSeedlist(seedlist) {
797
796
} ) ) ;
798
797
}
799
798
800
- function topologyTypeFromSeedlist ( seedlist , options ) {
799
+ function topologyTypeFromSeedlist ( options ) {
801
800
if ( options . directConnection ) {
802
801
return TopologyType . Single ;
803
802
}
Original file line number Diff line number Diff line change @@ -277,23 +277,19 @@ class TopologyDescription {
277
277
}
278
278
279
279
function topologyTypeForServerType ( serverType ) {
280
- if ( serverType === ServerType . Standalone ) {
281
- return TopologyType . Single ;
282
- }
283
-
284
- if ( serverType === ServerType . Mongos ) {
285
- return TopologyType . Sharded ;
286
- }
287
-
288
- if ( serverType === ServerType . RSPrimary ) {
289
- return TopologyType . ReplicaSetWithPrimary ;
290
- }
291
-
292
- if ( serverType === ServerType . RSGhost || serverType === ServerType . Unknown ) {
293
- return TopologyType . Unknown ;
280
+ switch ( serverType ) {
281
+ case ServerType . Standalone :
282
+ return TopologyType . Single ;
283
+ case ServerType . Mongos :
284
+ return TopologyType . Sharded ;
285
+ case ServerType . RSPrimary :
286
+ return TopologyType . ReplicaSetWithPrimary ;
287
+ case ServerType . RSGhost :
288
+ case ServerType . Unknown :
289
+ return TopologyType . Unknown ;
290
+ default :
291
+ return TopologyType . ReplicaSetNoPrimary ;
294
292
}
295
-
296
- return TopologyType . ReplicaSetNoPrimary ;
297
293
}
298
294
299
295
function compareObjectId ( oid1 , oid2 ) {
You can’t perform that action at this time.
0 commit comments