(description?: ServerDescription)
| 69 | * if it is in a state that it can have commands sent to it. |
| 70 | */ |
| 71 | export function sameServerSelector(description?: ServerDescription): ServerSelector { |
| 72 | return function sameServerSelector( |
| 73 | _topologyDescription: TopologyDescription, |
| 74 | servers: ServerDescription[], |
| 75 | _deprioritized: DeprioritizedServers |
| 76 | ): ServerDescription[] { |
| 77 | if (!description) return []; |
| 78 | // Filter the servers to match the provided description only if |
| 79 | // the type is not unknown. |
| 80 | return servers.filter(sd => { |
| 81 | return sd.address === description.address && sd.type !== ServerType.Unknown; |
| 82 | }); |
| 83 | }; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Returns a server selector that uses a read preference to select a |
no test coverage detected