MongoDB\Driver\Cursor::getServer
En esta página
MongoDB\Driver\Cursor::getServer
Devuelve el servidor asociado con este cursor
Descripción#
final public MongoDB\Driver\Cursor::getServer(): MongoDB\Driver\Server
```php
Devuelve el `MongoDB\Driver\Server` asociado con este cursor. Este es el servidor que ejecutó la `MongoDB\Driver\Query` o la `MongoDB\Driver\Command`.
## Parámetros
Esta función no contiene ningún parámetro.
## Valores devueltos
Devuelve el `MongoDB\Driver\Server` asociado con este cursor.
## Errores/Excepciones
Lanza una excepción
MongoDB\Driver\Exception\InvalidArgumentException
en caso de error durante el análisis de un argumento.
## Ejemplos
Ejemplo de `MongoDB\Driver\Cursor::getServer`
```php
Resultado del ejemplo anterior es similar a:
object(MongoDB\Driver\Server)#5 (10) {
["host"]=>
string(9) "localhost"
["port"]=>
int(27017)
["type"]=>
int(1)
["is_primary"]=>
bool(false)
["is_secondary"]=>
bool(false)
["is_arbiter"]=>
bool(false)
["is_hidden"]=>
bool(false)
["is_passive"]=>
bool(false)
["last_hello_response"]=>
array(8) {
["isWritablePrimary"]=>
bool(true)
["maxBsonObjectSize"]=>
int(16777216)
["maxMessageSizeBytes"]=>
int(48000000)
["maxWriteBatchSize"]=>
int(1000)
["localTime"]=>
object(MongoDB\BSON\UTCDateTime)#6 (1) {
["milliseconds"]=>
int(1446505367907)
}
["maxWireVersion"]=>
int(3)
["minWireVersion"]=>
int(0)
["ok"]=>
float(1)
}
["round_trip_time"]=>
int(584)
}
Véase también#
MongoDB\Driver\Server