Skip to content

Commit 636fadc

Browse files
committed
edits
1 parent 1db15e2 commit 636fadc

File tree

5 files changed

+102
-101
lines changed

5 files changed

+102
-101
lines changed

config/redirects

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ raw: ${prefix}/stable -> ${base}/current/
9292
[*-master]: ${prefix}/${version}/aggregation/vector-search/ -> ${base}/${version}/vector-search/
9393
[*-master]: ${prefix}/${version}/monitoring/ -> ${base}/${version}/monitoring-logging/
9494
[*-master]: ${prefix}/${version}/read/ -> ${base}/${version}/crud/
95-
[*-master]: ${prefix}/${version}/write/ -> ${base}/${version}/crud/
95+
[*-master]: ${prefix}/${version}/write/ -> ${base}/${version}/crud/
96+
[*-master]: ${prefix}/${version}/faq/ -> ${base}/${version}/

source/connect/client.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,12 @@ Troubleshooting
124124
This section addresses issues that you might encounter when using a
125125
MongoDB client.
126126

127-
Client Persistence Errors
128-
~~~~~~~~~~~~~~~~~~~~~~~~~
127+
Client Persistence Considerations
128+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129129

130-
Connections to the MongoDB deployment are handled by the ``libmongoc``
131-
library and the :php:`{+extension-short+} <mongodb>`. When you construct
132-
a :phpclass:`MongoDB\Client` instance, the {+library-short+} creates a
133-
:php:`MongoDB\Driver\Manager <class.mongodb-driver-manager>` instance by using the
130+
The ``libmongoc`` library and the {+extension-short+} handle connections
131+
to a MongoDB deployment. When you construct a :phpclass:`MongoDB\Client` instance, the
132+
{+library-short+} creates a :php:`MongoDB\Driver\Manager <class.mongodb-driver-manager>` instance by using the
134133
same connection string and options. The extension also uses those constructor
135134
arguments to derive a hash key for persistent ``libmongoc`` clients. If
136135
you previously persisted a ``libmongoc`` client by using a key, it is
@@ -151,7 +150,7 @@ after a ``MongoDB\Driver\Manager`` object goes out of scope. While this is
151150
typically not an issue for applications that connect to one MongoDB deployment,
152151
it might cause errors in the following situations:
153152

154-
- PHP-FPM is configured with ``pm.max_requests=0``, so that workers never respawn, and a
153+
- PHP-FPM is configured with ``pm.max_requests=0`` so workers never respawn, and a
155154
PHP application is deployed many times with small changes to its MongoDB
156155
connection string or options. This could lead to an accumulation of ``libmongoc``
157156
client objects in each worker process.

source/connect/connection-options.txt

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -321,93 +321,6 @@ Miscellaneous Configuration
321321
| **MongoDB\\Client Example**: ``$uriOptions = ['srvMaxHosts' => 5];``
322322
| **Connection URI Example**: ``srvMaxHosts=5``
323323

324-
Troubleshooting
325-
---------------
326-
327-
This section addresses issues related to MongoDB connection options.
328-
329-
Server Selection Errors
330-
~~~~~~~~~~~~~~~~~~~~~~~
331-
332-
The following code shows possible server selection error
333-
messages that your application might generate:
334-
335-
.. code-block:: none
336-
:copyable: false
337-
338-
No suitable servers found (`serverSelectionTryOnce` set):
339-
[connection refused calling hello on 'a.example.com:27017']
340-
[connection refused calling hello on 'b.example.com:27017']
341-
342-
No suitable servers found: `serverSelectionTimeoutMS` expired:
343-
[socket timeout calling hello on 'example.com:27017']
344-
345-
No suitable servers found: `serverSelectionTimeoutMS` expired:
346-
[connection timeout calling hello on 'a.example.com:27017']
347-
[connection timeout calling hello on 'b.example.com:27017']
348-
[TLS handshake failed: -9806 calling hello on 'c.example.com:27017']
349-
350-
No suitable servers found: `serverselectiontimeoutms` timed out:
351-
[TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on 'a.example.com:27017']
352-
[TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on 'b.example.com:27017']
353-
354-
The {+extension-short+} usually represents these errors as
355-
:php:`MongoDB\Driver\Exception\ConnectionTimeoutException <mongodb-driver-exception-connectiontimeoutexception>`
356-
exceptions. However, the exception messages originate from
357-
``libmongoc``, which is the underlying system library used by the extension. Since
358-
these messages can take many forms, we recommend breaking down the structure of
359-
the message so you can better diagnose errors in your application.
360-
361-
Messages typically start with "No suitable servers found". The next part of
362-
the message indicates *how* server selection failed. The extension
363-
avoids a server selection loop and makes a single attempt by default, according to
364-
the ``serverSelectionTryOnce`` connection string option. If the extension is
365-
configured to use a loop, a message that includes the phrase "serverSelectionTimeoutMS expired"
366-
indicates that you exhausted its time limit.
367-
368-
The last component of the message tells us *why* server selection failed and
369-
includes one or more errors directly from the topology scanner, which is the
370-
service responsible for connecting to and monitoring each host. Any host that
371-
previously experienced an error during monitoring will be included in this list. These
372-
messages typically originate from low-level socket or TLS functions.
373-
374-
The following list describes the possible meanings of common phrases in the last error message
375-
component:
376-
377-
- "Connection refused": The remote host might not be not listening on
378-
the expected port.
379-
- "Connection timeout": There might be a routing problem, a firewall error, or
380-
a timeout due to latency.
381-
- "Socket timeout": You likely established an initial connection that
382-
was dropped or timed out due to latency.
383-
- "TLS handshake failed": TLS or OCSP verification did not succeed, and you might
384-
have misconfigured TLS certificates.
385-
386-
In the case of a connection failure, you can use the ``connect`` tool for
387-
more troubleshooting information. This tool tries to connect to each host in a
388-
connection string by using socket functions, and then attempts to interact with
389-
data. If you used Composer to install the library, you can use the following command
390-
to use the ``connect`` tool:
391-
392-
.. code-block:: none
393-
394-
php vendor/mongodb/mongodb/tools/connect.php <connection URI>
395-
396-
If the server you are connecting to does not accept connections, the output
397-
resembles the following code:
398-
399-
.. code-block:: none
400-
401-
Looking up MongoDB at <connection URI>
402-
Found 1 host(s) in the URI. Will attempt to connect to each.
403-
404-
Could not connect to <host>:<port>: Connection refused
405-
406-
.. note::
407-
408-
The tool supports only the ``mongodb://`` URI schema. Using the
409-
``mongodb+srv`` scheme is not supported.
410-
411324
API Documentation
412325
-----------------
413326

source/connect/connection-targets.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,94 @@ DNS Service Discovery
124124

125125
$uri = 'mongodb+srv://<hostname>/';
126126

127+
Troubleshooting
128+
---------------
129+
130+
This section addresses issues that you might encounter when
131+
connecting to a MongoDB deployment.
132+
133+
Server Selection Errors
134+
~~~~~~~~~~~~~~~~~~~~~~~
135+
136+
The following code shows possible server selection error
137+
messages that your application might generate:
138+
139+
.. code-block:: none
140+
:copyable: false
141+
142+
No suitable servers found (`serverSelectionTryOnce` set):
143+
[connection refused calling hello on 'a.example.com:27017']
144+
[connection refused calling hello on 'b.example.com:27017']
145+
146+
No suitable servers found: `serverSelectionTimeoutMS` expired:
147+
[socket timeout calling hello on 'example.com:27017']
148+
149+
No suitable servers found: `serverSelectionTimeoutMS` expired:
150+
[connection timeout calling hello on 'a.example.com:27017']
151+
[connection timeout calling hello on 'b.example.com:27017']
152+
[TLS handshake failed: -9806 calling hello on 'c.example.com:27017']
153+
154+
No suitable servers found: `serverselectiontimeoutms` timed out:
155+
[TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on 'a.example.com:27017']
156+
[TLS handshake failed: certificate verify failed (64): IP address mismatch calling hello on 'b.example.com:27017']
157+
158+
The {+extension-short+} usually represents these errors as
159+
:php:`MongoDB\Driver\Exception\ConnectionTimeoutException <mongodb-driver-exception-connectiontimeoutexception>`
160+
exceptions. However, the exception messages originate from
161+
``libmongoc``, which is the underlying system library used by the extension. Since
162+
these messages can take many forms, we recommend breaking down the structure of
163+
the message so you can better diagnose errors in your application.
164+
165+
Messages typically start with "No suitable servers found". The next part of
166+
the message indicates *how* server selection failed. The extension
167+
avoids a server selection loop and makes a single attempt by default, according to
168+
the ``serverSelectionTryOnce`` connection string option. If the extension is
169+
configured to use a loop, a message that includes the phrase "serverSelectionTimeoutMS expired"
170+
indicates that you exhausted its time limit.
171+
172+
The last component of the message tells us *why* server selection failed and
173+
includes one or more errors directly from the topology scanner, which is the
174+
service responsible for connecting to and monitoring each host. Any host that
175+
previously experienced an error during monitoring will be included in this list. These
176+
messages typically originate from low-level socket or TLS functions.
177+
178+
The following list describes the possible meanings of common phrases in the last error message
179+
component:
180+
181+
- "Connection refused": The remote host might not be not listening on
182+
the expected port.
183+
- "Connection timeout": There might be a routing problem, a firewall error, or
184+
a timeout due to latency.
185+
- "Socket timeout": You likely established an initial connection that
186+
was dropped or timed out due to latency.
187+
- "TLS handshake failed": TLS or OCSP verification did not succeed, and you might
188+
be using misconfigured TLS certificates.
189+
190+
In the case of a connection failure, you can use the ``connect`` tool for
191+
more troubleshooting information. This tool tries to connect to each host in a
192+
connection string by using socket functions, and then attempts to interact with
193+
data. If you used Composer to install the library, you can use the following command
194+
to start the ``connect`` tool:
195+
196+
.. code-block:: none
197+
198+
php vendor/mongodb/mongodb/tools/connect.php <connection URI>
199+
200+
If the server you are connecting to does not accept connections, the output
201+
resembles the following code:
202+
203+
.. code-block:: none
204+
205+
Looking up MongoDB at <connection URI>
206+
Found 1 host(s) in the URI. Will attempt to connect to each.
207+
208+
Could not connect to <host>:<port>: Connection refused
209+
210+
.. note::
211+
212+
The tool supports only the ``mongodb://`` URI schema. Using the
213+
``mongodb+srv`` scheme is not supported.
214+
127215
API Documentation
128216
-----------------
129217

source/get-started.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ This section addresses issues that you might encounter when installing the
355355
PHP Headers Not Found
356356
~~~~~~~~~~~~~~~~~~~~~
357357

358-
You might see a PHP header file error that resembles the following code when installing
359-
the {+library-short+}
358+
You might see a header file error that resembles the following code when installing
359+
the {+library-short+}:
360360

361361
.. code-block:: none
362362
:copyable: false
@@ -376,7 +376,7 @@ If you install a PHP runtime, the corresponding headers are not always automatic
376376
available. On many Linux distributions, headers are often published under a
377377
separate ``php-dev`` or ``php-devel`` package. On macOS, the default PHP runtime
378378
does not include headers. Users typically need to install PHP and its headers by using
379-
`Homebrew <https://brew.sh/>`__ to build an extension.
379+
`Homebrew <https://brew.sh/>`__.
380380

381381
Multiple PHP Runtimes Installed
382382
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -389,15 +389,15 @@ ensure that you use the correct ``pecl`` or ``pie`` command and modify the appro
389389
file.
390390

391391
To see which ``php.ini`` file a PHP runtime uses,
392-
examine the output of :php:`phpinfo() <phpinfo>` for that particular
392+
view the output of :php:`phpinfo() <phpinfo>` for that particular
393393
SAPI. Additionally, you can use :php:`php_ini_loaded_file() <php_ini_loaded_file>` and
394394
:php:`php_ini_scanned_files() <php_ini_scanned_files>` to determine
395395
which INI files have been loaded by PHP.
396396

397397
To debug issues when the extension is not loaded, you can use the
398398
``detect-extension`` script provided in the tools directory. You can run this
399399
script from the CLI or include it in a script accessible to your web server.
400-
The tool will point out potential issues and installation instructions for your
400+
The tool finds potential issues and installation instructions for your
401401
system. If you installed the library by using Composer, you can call the
402402
script from the vendor directory as shown in the following code:
403403

@@ -438,4 +438,4 @@ inferred from :php:`phpinfo() <phpinfo>`. If your system has multiple PHP
438438
runtimes installed, view the ``phpinfo()`` output for the correct environment.
439439

440440
You can also use the ``detect-extension`` script described in the previous section to determine the
441-
appropriate DLL for your PHP environment.
441+
correct DLL for your PHP environment.

0 commit comments

Comments
 (0)