| 212 | } |
| 213 | |
| 214 | get serverSession(): ServerSession { |
| 215 | let serverSession = this._serverSession; |
| 216 | if (serverSession == null) { |
| 217 | if (this.explicit) { |
| 218 | throw new MongoRuntimeError('Unexpected null serverSession for an explicit session'); |
| 219 | } |
| 220 | if (this.hasEnded) { |
| 221 | throw new MongoRuntimeError('Unexpected null serverSession for an ended implicit session'); |
| 222 | } |
| 223 | serverSession = this.sessionPool.acquire(); |
| 224 | this._serverSession = serverSession; |
| 225 | } |
| 226 | return serverSession; |
| 227 | } |
| 228 | |
| 229 | get loadBalanced(): boolean { |
| 230 | return this.client.topology?.description.type === TopologyType.LoadBalanced; |