PHP 8.4.1 Released!

MongoDB\Driver\Session::getServer

(mongodb >=1.6.0)

MongoDB\Driver\Session::getServerReturns the server to which this session is pinned

说明

final public MongoDB\Driver\Session::getServer(): ?MongoDB\Driver\Server

Returns the MongoDB\Driver\Server to which this session is pinned. If the session is not pinned to a server, null will be returned.

Session pinning is primarily used for sharded transactions, as all commands within a sharded transaction must be sent to the same mongos instance. This method is intended to be used by libraries built atop the extension to allow use of a pinned server instead of invoking server selection.

参数

此函数没有参数。

返回值

Returns the MongoDB\Driver\Server to which this session is pinned, or null if the session is not pinned to any server.

错误/异常

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top