Php/docs/mongoclient.getconnections

提供:Dev Guides
< Php
移動先:案内検索

MongoClient::getConnections

(PECL mongo >=1.3.0)

MongoClient::getConnections開いているすべての接続の情報を返す


このメソッドを定義している拡張モジュールは非推奨です。 かわりに MongoDB 拡張モジュールを使うべきです。 このメソッドの代替は、新しい拡張モジュールには存在しません。


説明

public static MongoClient::getConnections ( ) : array

開いているすべての接続と、それぞれのサーバーの情報を配列で返します。


パラメータ

この関数にはパラメータはありません。


返り値

開いている接続に関する配列を返します。


例1 MongoClient::getConnections() の例

<?php$m = new MongoClient;var_dump($m->getConnections());?>

上の例の出力は、 たとえば以下のようになります。


array(1) {
  [0]=>
  array(3) {
    ["hash"]=>
    string(26) "localhost:27017;-;X;56052"
    ["server"]=>
    array(3) {
      ["host"]=>
      string(10) "localhost"
      ["port"]=>
      int(27017)
      ["pid"]=>
      int(56052)
    }
    ["connection"]=>
    array(8) {
      ["last_ping"]=>
      int(1354076401)
      ["last_ismaster"]=>
      int(0)
      ["ping_ms"]=>
      int(0)
      ["connection_type"]=>
      int(1)
      ["connection_type_desc"]=>
      string(10) "STANDALONE"
      ["max_bson_size"]=>
      int(16777216)
      ["tag_count"]=>
      int(0)
      ["tags"]=>
      array(0) {
      }
    }
  }
}