reference/mongodb/mongodb/driver/server/getinfo.xml
bd6e6603b4614c35d9b63c8d157a98569f2358df
...
...
@@ -4,7 +4,7 @@
4
4
<refentry xml:id="mongodb-driver-server.getinfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
5
<refnamediv>
6
6
<refname>MongoDB\Driver\Server::getInfo</refname>
7
-
<refpurpose>Returns an array of information about this server</refpurpose>
7
+
<refpurpose>Returns an array of information describing this server</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
...
...
@@ -14,8 +14,22 @@
14
14
<void />
15
15
</methodsynopsis>
16
16
<para>
17
-
Returns an array of information about this server.
17
+
Returns an array of information describing the server. This array is derived
18
+
from the most recent
19
+
<link xlink:href="&url.mongodb.docs;reference/command/hello/">hello</link>
20
+
command response obtained through
21
+
<link xlink:href="&url.mongodb.sdam;">server monitoring</link>.
18
22
</para>
23
+
<note>
24
+
<para>
25
+
When the driver is connected to a load balancer, this method will return
26
+
the backing server's
27
+
<link xlink:href="&url.mongodb.docs;reference/command/hello/">hello</link>
28
+
command response from the initial connection handshake. This is in contrast
29
+
to other methods (e.g. <function>MongoDB\Driver\Server::getType</function>),
30
+
which will return information about the load balancer itself.
31
+
</para>
32
+
</note>
19
33
</refsect1>
20
34

21
35
<refsect1 role="parameters">
...
...
@@ -26,7 +40,7 @@
26
40
<refsect1 role="returnvalues">
27
41
&reftitle.returnvalues;
28
42
<para>
29
-
Returns an array of information about this server.
43
+
Returns an array of information describing this server.
30
44
</para>
31
45
</refsect1>
32
46

...
...
@@ -46,9 +60,9 @@
46
60
<![CDATA[
47
61
<?php
48
62

49
-
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017/");
63
+
$manager = new MongoDB\Driver\Manager('mongodb://localhost:27017/');
50
64

51
-
$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
65
+
$rp = new MongoDB\Driver\ReadPreference('primary');
52
66
$server = $manager->selectServer($rp);
53
67

54
68
var_dump($server->getInfo());
...
...
@@ -59,32 +73,171 @@ var_dump($server->getInfo());
59
73
&example.outputs.similar;
60
74
<screen>
61
75
<![CDATA[
62
-
array(8) {
63
-
["isWritablePrimary"]=>
76
+
array(23) {
77
+
["helloOk"]=>
64
78
bool(true)
79
+
["topologyVersion"]=>
80
+
array(2) {
81
+
["processId"]=>
82
+
object(MongoDB\BSON\ObjectId)#4 (1) {
83
+
["oid"]=>
84
+
string(24) "617b6d696a3a89d2f77e6df0"
85
+
}
86
+
["counter"]=>
87
+
int(6)
88
+
}
89
+
["hosts"]=>
90
+
array(1) {
91
+
[0]=>
92
+
string(15) "localhost:27017"
93
+
}
94
+
["setName"]=>
95
+
string(3) "rs0"
96
+
["setVersion"]=>
97
+
int(1)
98
+
["ismaster"]=>
99
+
bool(true)
100
+
["secondary"]=>
101
+
bool(false)
102
+
["primary"]=>
103
+
string(15) "localhost:27017"
104
+
["me"]=>
105
+
string(15) "localhost:27017"
106
+
["electionId"]=>
107
+
object(MongoDB\BSON\ObjectId)#5 (1) {
108
+
["oid"]=>
109
+
string(24) "7fffffff0000000000000001"
110
+
}
111
+
["lastWrite"]=>
112
+
array(4) {
113
+
["opTime"]=>
114
+
array(2) {
115
+
["ts"]=>
116
+
object(MongoDB\BSON\Timestamp)#6 (2) {
117
+
["increment"]=>
118
+
string(1) "1"
119
+
["timestamp"]=>
120
+
string(10) "1635478989"
121
+
}
122
+
["t"]=>
123
+
int(1)
124
+
}
125
+
["lastWriteDate"]=>
126
+
object(MongoDB\BSON\UTCDateTime)#7 (1) {
127
+
["milliseconds"]=>
128
+
string(13) "1635478989000"
129
+
}
130
+
["majorityOpTime"]=>
131
+
array(2) {
132
+
["ts"]=>
133
+
object(MongoDB\BSON\Timestamp)#8 (2) {
134
+
["increment"]=>
135
+
string(1) "1"
136
+
["timestamp"]=>
137
+
string(10) "1635478989"
138
+
}
139
+
["t"]=>
140
+
int(1)
141
+
}
142
+
["majorityWriteDate"]=>
143
+
object(MongoDB\BSON\UTCDateTime)#9 (1) {
144
+
["milliseconds"]=>
145
+
string(13) "1635478989000"
146
+
}
147
+
}
65
148
["maxBsonObjectSize"]=>
66
149
int(16777216)
67
150
["maxMessageSizeBytes"]=>
68
151
int(48000000)
69
152
["maxWriteBatchSize"]=>
70
-
int(1000)
153
+
int(100000)
71
154
["localTime"]=>
72
-
object(MongoDB\BSON\UTCDateTime)#4 (1) {
155
+
object(MongoDB\BSON\UTCDateTime)#10 (1) {
73
156
["milliseconds"]=>
74
-
int(1447276242774)
157
+
string(13) "1635478992136"
75
158
}
76
-
["maxWireVersion"]=>
159
+
["logicalSessionTimeoutMinutes"]=>
160
+
int(30)
161
+
["connectionId"]=>
77
162
int(3)
78
163
["minWireVersion"]=>
79
164
int(0)
165
+
["maxWireVersion"]=>
166
+
int(13)
167
+
["readOnly"]=>
168
+
bool(false)
80
169
["ok"]=>
81
170
float(1)
171
+
["$clusterTime"]=>
172
+
array(2) {
173
+
["clusterTime"]=>
174
+
object(MongoDB\BSON\Timestamp)#11 (2) {
175
+
["increment"]=>
176
+
string(1) "1"
177
+
["timestamp"]=>
178
+
string(10) "1635478989"
179
+
}
180
+
["signature"]=>
181
+
array(2) {
182
+
["hash"]=>
183
+
object(MongoDB\BSON\Binary)#12 (2) {
184
+
["data"]=>
185
+
string(20) ""
186
+
["type"]=>
187
+
int(0)
188
+
}
189
+
["keyId"]=>
190
+
int(0)
191
+
}
192
+
}
193
+
["operationTime"]=>
194
+
object(MongoDB\BSON\Timestamp)#13 (2) {
195
+
["increment"]=>
196
+
string(1) "1"
197
+
["timestamp"]=>
198
+
string(10) "1635478989"
199
+
}
82
200
}
83
201
]]>
84
202
</screen>
85
203
</example>
86
204
</refsect1>
87
205

206
+
<refsect1 role="changelog">
207
+
&reftitle.changelog;
208
+
<para>
209
+
<informaltable>
210
+
<tgroup cols="2">
211
+
<thead>
212
+
<row>
213
+
<entry>&Version;</entry>
214
+
<entry>&Description;</entry>
215
+
</row>
216
+
</thead>
217
+
<tbody>
218
+
<row>
219
+
<entry>PECL mongodb 1.11.0</entry>
220
+
<entry>
221
+
When the driver is connected to a load balancer, this method returns
222
+
the backing server's <literal>hello</literal> command response from the
223
+
initial connection handshake.
224
+
</entry>
225
+
</row>
226
+
</tbody>
227
+
</tgroup>
228
+
</informaltable>
229
+
</para>
230
+
</refsect1>
231
+

232
+
<refsect1 role="seealso">
233
+
&reftitle.seealso;
234
+
<simplelist>
235
+
<member><function>MongoDB\Driver\ServerDescription::getHelloResponse</function></member>
236
+
<member><link xlink:href="&url.mongodb.docs;reference/command/hello/">hello</link> command in the MongoDB manual</member>
237
+
<member><link xlink:href="&url.mongodb.sdam;">Server Discovery and Monitoring Specification</link></member>
238
+
</simplelist>
239
+
</refsect1>
240
+

88
241
</refentry>
89
242

90
243
<!-- Keep this comment at the end of the file
91
244