Skip to content

Commit 4567967

Browse files
committed
Merge remote-tracking branch 'upstream/php-standardization' into DOCSP-41989-secure-landing
2 parents 6101f20 + 855563c commit 4567967

31 files changed

+647
-2050
lines changed

snooty.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ toc_landing_pages = [
2222
"/reference/class/MongoDBModelDatabaseInfo",
2323
"/reference/class/MongoDBModelIndexInfo",
2424
"/get-started",
25+
"/databases-collections",
2526
"/write",
2627
"/indexes",
2728
"/security"
29+
"/data-formats"
2830
]
2931

3032
sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
@@ -34,7 +36,7 @@ php-library = "MongoDB PHP Library"
3436

3537
[constants]
3638
php-library = "MongoDB PHP Library"
37-
driver-short = "PHP library"
39+
library-short = "PHP library"
3840
stable-api = "Stable API"
3941
mdb-server = "MongoDB Server"
4042
api = "https://www.mongodb.com/docs/php-library/current/reference"

source/compatibility.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ The first column lists the version of the library and extension.
4444

4545
.. include:: /includes/language-compatibility-table-php.rst
4646

47-
.. sharedinclude:: dbx/about-driver-compatibility.rst
48-
4947
For more information on how to read the compatibility tables, see our guide on
5048
:ref:`MongoDB Compatibility Tables <about-driver-compatibility>`.
5149

source/connect/client.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Overview
2222

2323
To connect to a MongoDB deployment, you must create the following items:
2424

25-
- **Connection URI**, also known as a *connection string*, which tells the {+driver-short+}
25+
- **Connection URI**, also known as a *connection string*, which tells the {+library-short+}
2626
which MongoDB deployment to connect to.
2727
- **MongoDB\\Client** object, which creates the connection to the MongoDB deployment
2828
and lets you perform operations on it.
2929

3030
You can also set options within either or both of these components to
31-
customize the way that the {+driver-short+} behaves
31+
customize the way that the {+library-short+} behaves
3232
while connected to MongoDB.
3333

3434
This guide describes the components of a connection string and shows how to
@@ -99,7 +99,7 @@ deployment on port ``27017`` of ``localhost``:
9999
API Documentation
100100
-----------------
101101

102-
To learn more about creating a ``MongoDB\Client`` object in the {+driver-short+},
102+
To learn more about creating a ``MongoDB\Client`` object in the {+library-short+},
103103
see the following API documentation:
104104

105105
- :ref:`MongoDB\Client <php-api-mongodbclient>`

source/connect/connection-targets.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ breaking changes when Atlas upgrades to a new version of {+mdb-server+}.
4242
To learn more about the {+stable-api+} feature, see the :ref:`{+stable-api+} page
4343
<php-stable-api>`.
4444

45-
The following code shows how to use the {+driver-short+} to connect to an Atlas cluster.
45+
The following code shows how to use the {+library-short+} to connect to an Atlas cluster.
4646
The code also uses the ``serverApi`` option to specify a {+stable-api+} version.
4747

4848
.. literalinclude:: /includes/connect/atlas.php
@@ -63,7 +63,7 @@ To connect to a local MongoDB deployment, use ``localhost`` as the hostname. By
6363
default, the ``mongod`` process runs on port 27017, though you can customize this for
6464
your deployment.
6565

66-
The following code shows how to use the {+driver-short+} to connect to a local MongoDB
66+
The following code shows how to use the {+library-short+} to connect to a local MongoDB
6767
deployment:
6868

6969
.. literalinclude:: /includes/connect/client.php
@@ -79,7 +79,7 @@ To connect to a replica set, specify the hostnames (or IP addresses) and
7979
port numbers of the replica set members in your connection string.
8080

8181
If you aren't able to provide a full list of hosts in the replica set, you can
82-
specify one or more of the hosts in the replica set and instruct the {+driver-short+} to
82+
specify one or more of the hosts in the replica set and instruct the {+library-short+} to
8383
perform automatic discovery to find the others. To instruct the driver to perform
8484
automatic discovery, choose one of the following actions:
8585

source/connect/tls.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Overview
2323
In this guide, you can learn how to use the :wikipedia:`TLS <Transport_Layer_Security>`
2424
protocol to secure your connection to a MongoDB deployment.
2525

26-
When you enable TLS for a connection, the {+driver-short+} performs the following actions:
26+
When you enable TLS for a connection, the {+library-short+} performs the following actions:
2727

2828
- Uses TLS to connect to the MongoDB deployment
2929
- Verifies the deployment's certificate
@@ -41,7 +41,7 @@ To learn how to configure your MongoDB deployment for TLS, see the
4141

4242
.. tip::
4343

44-
The {+driver-short+} delegates most TLS behavior to the MongoDB C Driver.
44+
The {+library-short+} delegates most TLS behavior to the MongoDB C Driver.
4545
For information about how the C driver handles TLS, including configuration steps
4646
and expected behavior, see
4747
`Configuring TLS <https://www.mongodb.com/docs/languages/c/c-driver/current/libmongoc/guides/configuring_tls/#supported-libraries>`__
@@ -78,7 +78,7 @@ signed by a well-known CA (certificate authority), and your application relies o
7878
to validate the certificate.
7979

8080
During testing, however, you might want to act as your own CA.
81-
In this case, you must instruct the {+driver-short+} to
81+
In this case, you must instruct the {+library-short+} to
8282
use your CA certificates instead of ones signed by another CA.
8383

8484
To do so, use the ``tlsCAFile`` connection option to specify the path to a ``.pem`` file
@@ -95,7 +95,7 @@ Specify a CA Directory
9595

9696
If you are using OpenSSL or LibreSSL (``libtls``) for TLS support, you can also use
9797
the ``ca_dir`` option to instruct
98-
the {+driver-short+} to search for a CA file within a directory. The driver searches this
98+
the {+library-short+} to search for a CA file within a directory. The driver searches this
9999
directory if it doesn't find a CA file at the path specified in the ``tlsCAFile`` option.
100100

101101
The following code example shows how to use the ``driverOptions`` parameter to specify the
@@ -119,7 +119,7 @@ Check Certificate Revocation
119119
----------------------------
120120

121121
When an X.509 certificate is no longer trustworthy—for example, if its private key
122-
has been compromised—the CA revokes the certificate. The {+driver-short+} includes two ways
122+
has been compromised—the CA revokes the certificate. The {+library-short+} includes two ways
123123
to check whether a server's certificate has been revoked.
124124

125125
.. _php-disable-ocsp:
@@ -131,15 +131,15 @@ The Online Certificate Status Protocol (OCSP) process varies depending on the ve
131131
{+mdb-server+} you're connecting to:
132132

133133
- **MongoDB v4.4 or later:** The server staples a
134-
time-stamped OCSP response to its certificate. The {+driver-short+} validates the certificate
134+
time-stamped OCSP response to its certificate. The {+library-short+} validates the certificate
135135
against the OCSP response. If the CA has revoked the certificate, or if the OCSP response
136136
is otherwise invalid, the TLS handshake fails.
137-
- **MongoDB v4.3 or earlier:** The server supplies an OCSP endpoint, which the {+driver-short+}
138-
contacts directly. The {+driver-short+} then validates the certificate against the OCSP
137+
- **MongoDB v4.3 or earlier:** The server supplies an OCSP endpoint, which the {+library-short+}
138+
contacts directly. The {+library-short+} then validates the certificate against the OCSP
139139
response. If the CA hasn't revoked the certificate, the TLS handshake continues, even if
140140
the OCSP response is invalid or malformed.
141141

142-
To stop the {+driver-short+} from contacting the OCSP endpoint, set the
142+
To stop the {+library-short+} from contacting the OCSP endpoint, set the
143143
``tlsDisableOCSPEndpointCheck`` connection option to ``true``.
144144
You can do this in two ways: by passing an argument to the
145145
``MongoDB\Client`` constructor or through a parameter in your connection string.
@@ -148,15 +148,15 @@ You can do this in two ways: by passing an argument to the
148148

149149
.. note::
150150

151-
Even if the ``tlsDisableOCSPEndpointCheck`` option is set to ``true``, the {+driver-short+}
151+
Even if the ``tlsDisableOCSPEndpointCheck`` option is set to ``true``, the {+library-short+}
152152
still verifies any OCSP response stapled to a server's certificate.
153153

154154
.. _php-crl:
155155

156156
Certificate Revocation List
157157
~~~~~~~~~~~~~~~~~~~~~~~~~~~
158158

159-
Instead of using OCSP, you can use the instruct the {+driver-short+}
159+
Instead of using OCSP, you can use the instruct the {+library-short+}
160160
to check the server's certificate
161161
against a Certificate Revocation List (CRL) published by the CA. To do so, set the
162162
``crl_file`` option to the file path of the CRL. Include this option in the
@@ -177,7 +177,7 @@ Present a Client Certificate
177177
----------------------------
178178

179179
Some MongoDB deployments require every connecting application to present a client certificate
180-
that proves its identity. To specify the client certificate for the {+driver-short+} to
180+
that proves its identity. To specify the client certificate for the {+library-short+} to
181181
present, set the ``tleCertificateKeyFile`` option to the file path of the ``.pem`` file that
182182
contains your certificate and private key.
183183

@@ -214,7 +214,7 @@ of the ``MongoDB\Client`` constructor or through a parameter in your connection
214214
Allow Insecure TLS
215215
------------------
216216

217-
When TLS is enabled, the {+driver-short+} automatically verifies the certificate that
217+
When TLS is enabled, the {+library-short+} automatically verifies the certificate that
218218
the server presents. When testing your code, you can disable this verification.
219219
This is known as *insecure TLS.*
220220

@@ -262,7 +262,7 @@ To disable only hostname verification, set the ``tlsAllowInvalidHostnames`` opti
262262
API Documentation
263263
-----------------
264264

265-
To learn more about configuring TLS for the {+driver-short+},
265+
To learn more about configuring TLS for the {+library-short+},
266266
see the following API documentation:
267267

268-
- :ref:`MongoDB\Client <php-mongodb-client>`
268+
- :phpclass:`MongoDB\Client`

source/data-formats.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _php-data-formats:
2+
3+
========================
4+
Specialized Data Formats
5+
========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
.. facet::
14+
:name: genre
15+
:values: reference
16+
17+
.. meta::
18+
:keywords: store, bson, codec
19+
20+
.. toctree::
21+
:titlesonly:
22+
:maxdepth: 1
23+
24+
/data-formats/custom-types
25+
/data-formats/codecs
26+
/data-formats/decimal128
27+
/data-formats/modeling-bson-data
28+
29+
30+
Overview
31+
--------
32+
33+
You can use several types of specialized data formats in your {+library-short+}
34+
application. To learn how to work with these data formats, see the following
35+
guides:
36+
37+
- :ref:`php-custom-types`
38+
- :ref:`php-codecs`
39+
- :ref:`php-decimal128`
40+
- :ref:`php-bson`
File renamed without changes.

source/tutorial/custom-types.txt renamed to source/data-formats/custom-types.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _php-custom-types:
2+
13
=================
24
Custom Data-Types
35
=================

source/tutorial/decimal128.txt renamed to source/data-formats/decimal128.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _php-decimal128:
2+
13
==========
24
Decimal128
35
==========

source/tutorial/modeling-bson-data.txt renamed to source/data-formats/modeling-bson-data.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _php-bson:
2+
13
==================
24
Modeling BSON Data
35
==================

source/databases-collections.txt

Lines changed: 4 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ The following example deletes the ``test_collection`` collection:
193193
Configure Read and Write Operations
194194
-----------------------------------
195195

196-
You can control how the library routes read operations by setting a **read preference**.
197-
You can also control options for how the library waits for acknowledgment of
198-
read and write operations on a replica set by setting a **read concern** and a
199-
**write concern**.
196+
You can control how read and write operations run on replica sets
197+
by specifying a read preference, read concern, or write concern.
200198

201199
By default, databases inherit read and write settings from the ``MongoDB\Client``
202200
instance. Collections inherit these settings from the ``MongoDB\Client`` or
@@ -205,114 +203,8 @@ You can change these settings by passing an options array to the
205203
``MongoDB\Client::selectDatabase()``, ``MongoDB\Client::selectCollection()``, or
206204
``MongoDB\Database::selectCollection()`` methods.
207205

208-
To change the read preference, read concern, and write concern of your database
209-
or collection, set the following options in the array parameter:
210-
211-
- ``readPreference``: Sets the read preference. For a list of available read
212-
preferences, see :php:`MongoDB\Driver\ReadPreference <mongodb-driver-readpreference>`
213-
in the extension API documentation.
214-
- ``readConcern``: Sets the read concern. For a list of available read
215-
concerns, see :php:`MongoDB\Driver\ReadConcern <mongodb-driver-readconcern>`
216-
in the extension API documentation.
217-
- ``writeConcern``: Sets the write concern. For a list of available write
218-
concerns, see :php:`MongoDB\Driver\WriteConcern <mongodb-driver-writeconcern>`
219-
in the extension API documentation.
220-
221-
.. tip::
222-
223-
To learn more about read preferences and read and write concerns, see the
224-
following guides in the MongoDB Server manual:
225-
226-
- :manual:`Read Preference </core/read-preference/>`
227-
- :manual:`Read Concern </reference/read-concern/>`
228-
- :manual:`Write Concern </reference/write-concern/>`
229-
230-
Database Configuration Example
231-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232-
233-
The following example shows how to set the read preference, read concern, and
234-
write concern of a database called ``test_database`` by passing an options
235-
array to ``selectDatabase()``:
236-
237-
.. literalinclude:: /includes/databases-collections/databases-collections.php
238-
:language: php
239-
:dedent:
240-
:start-after: start-database-settings
241-
:end-before: end-database-settings
242-
243-
Collection Configuration Example
244-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245-
246-
The following example shows how to set the read preference, read concern, and
247-
write concern of a collection called ``test_collection`` by passing an options
248-
array to ``selectCollection()``:
249-
250-
.. literalinclude:: /includes/databases-collections/databases-collections.php
251-
:language: php
252-
:dedent:
253-
:start-after: start-collection-settings
254-
:end-before: end-collection-settings
255-
256-
Advanced Read Configurations
257-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258-
259-
Tag Sets
260-
````````
261-
262-
In {+mdb-server+}, you can apply key-value :manual:`tags
263-
</core/read-preference-tags/>` to replica-set
264-
members according to any criteria you choose. You can then use
265-
those tags to target one or more members for a read operation.
266-
267-
By default, the {+php-library+} ignores tags when choosing a member
268-
to read from. To instruct the {+php-library+} to prefer certain tags,
269-
pass them as a parameter to your ``MongoDB\Driver\ReadPreference`` class
270-
constructor. Then, set the ``MongoDB\Driver\ReadPreference`` object as
271-
the value of the ``readPreference`` database option.
272-
273-
This code example sets the ``readPreference`` option to a tag set
274-
that instructs ``test_database`` to prefer reads from secondary replica set
275-
members in the following order:
276-
277-
1. Members from the New York data center (``['dc' => 'ny']``)
278-
#. Members from the San Francisco data center (``['dc' => 'sf']``)
279-
#. Any secondary members (``[]``)
280-
281-
.. literalinclude:: /includes/databases-collections/databases-collections.php
282-
:language: php
283-
:dedent:
284-
:start-after: start-tag-set
285-
:end-before: end-tag-set
286-
287-
Local Threshold
288-
```````````````
289-
290-
If multiple replica-set members match the read preference and tag sets you specify,
291-
the {+php-library+} reads from the nearest replica-set members, chosen according to
292-
their ping time.
293-
294-
By default, the library uses only members whose ping times are within 15 milliseconds
295-
of the nearest member for queries. To distribute reads between members with
296-
higher latencies, pass an options array to the ``MongoDB\Client`` constructor that
297-
sets the ``localThresholdMS`` option.
298-
299-
The following example specifies a local threshold of 35 milliseconds:
300-
301-
.. literalinclude:: /includes/databases-collections/databases-collections.php
302-
:language: php
303-
:dedent:
304-
:start-after: start-local-threshold
305-
:end-before: end-local-threshold
306-
307-
In the preceding example, the {+php-library+} distributes reads among matching members
308-
within 35 milliseconds of the closest member's ping time.
309-
310-
.. note::
311-
312-
The {+php-library+} ignores the value of ``localThresholdMS`` when communicating with a
313-
replica set through a ``mongos`` instance. In this case, use the
314-
:manual:`localThreshold </reference/program/mongos/#std-option-mongos.--localThreshold>`
315-
command-line option.
206+
To learn more about setting a read preference, read concern, and write concern,
207+
see the :ref:`php-read-write-pref` guide.
316208

317209
API Documentation
318210
-----------------

source/faq.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _php-faq:
2+
13
==========================
24
Frequently Asked Questions
35
==========================

0 commit comments

Comments
 (0)