/** * @return array */ protected function getIterationInfo() { $iterationInfo = ['started_iterating' => $this->cursor !== null]; if ($this->cursor !== null) { switch ($this->cursor->getServer()->getType()) { case \MongoDB\Driver\Server::TYPE_RS_ARBITER: $typeString = 'ARBITER'; break; case \MongoDB\Driver\Server::TYPE_MONGOS: $typeString = 'MONGOS'; break; case \MongoDB\Driver\Server::TYPE_RS_PRIMARY: $typeString = 'PRIMARY'; break; case \MongoDB\Driver\Server::TYPE_RS_SECONDARY: $typeString = 'SECONDARY'; break; default: $typeString = 'STANDALONE'; } $cursorId = (string) $this->cursor->getId(); $iterationInfo += ['id' => (int) $cursorId, 'at' => $this->position, 'numReturned' => $this->position, 'server' => sprintf('%s:%d;-;.;%d', $this->cursor->getServer()->getHost(), $this->cursor->getServer()->getPort(), getmypid()), 'host' => $this->cursor->getServer()->getHost(), 'port' => $this->cursor->getServer()->getPort(), 'connection_type_desc' => $typeString]; } return $iterationInfo; }