Skip to content

Commit 1274cc6

Browse files
authored
DOCSP-43396: Cleanup (#151)
* DOCSP-43396: Cleanup * quickstart fix * code fixes * edit * snooty * edit * code output * build log errors * another build fix * add info * upgrade guide to landing * fix * driver mentions * RR feedback * build fix
1 parent cf2b492 commit 1274cc6

File tree

81 files changed

+239
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+239
-202
lines changed

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ php-library = "MongoDB PHP Library"
3939

4040
[constants]
4141
php-library = "MongoDB PHP Library"
42-
driver-short = "PHP library"
4342
extension-short = "PHP extension"
4443
mdb-server = "MongoDB Server"
4544
stable-api = "Stable API"
4645
library-short = "PHP library"
46+
driver-short = "{+library-short+}"
4747
api = "https://www.mongodb.com/docs/php-library/current/reference"
4848
php-manual = "https://www.php.net/manual/en"
4949
string-data-type = "``string``"

source/aggregation.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,5 @@ API Documentation
201201
To learn more about the methods discussed in this guide, see the
202202
following API documentation:
203203

204-
- `MongoDB\\Collection::aggregate() <{+api+}/method/MongoDBCollection-aggregate/>`__
205-
- `MongoDB\\Collection::explain() <{+api+}/method/MongoDBCollection-explain/>`__
204+
- :phpmethod:`MongoDB\Collection::aggregate()`
205+
- :phpmethod:`MongoDB\Collection::explain()`

source/connect/client.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ API Documentation
102102
To learn more about creating a ``MongoDB\Client`` object in the {+library-short+},
103103
see the following API documentation:
104104

105-
- :ref:`MongoDB\Client <php-api-mongodbclient>`
105+
- :phpclass:`MongoDB\Client`

source/connect/connection-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ entry in the {+mdb-server+} manual.
8989
To learn more, see the following resources:
9090

9191
- `RFC 3986 <http://www.faqs.org/rfcs/rfc3986.html>`__
92-
- `rawurlencode <{+php-manual+}/rawurlencode>`__ in the PHP manual
92+
- :php:`rawurlencode <rawurlencode>` in the PHP manual
9393

9494
Replica Set Options
9595
~~~~~~~~~~~~~~~~~~~

source/connect/connection-targets.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ API Documentation
113113
To learn more about using the ``MongoDB\Client`` class,
114114
see the following API documentation:
115115

116-
- :ref:`MongoDB\Client <php-api-mongodbclient>`
116+
- :phpclass:`MongoDB\Client`

source/connect/stable-api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The following code example shows how you can use these parameters when construct
108108
API Documentation
109109
-----------------
110110

111-
For more information about the ``MongoDB\Client`` class, see the following {+driver-short+}
111+
For more information about the ``MongoDB\Client`` class, see the following {+library-short+}
112112
API documentation:
113113

114114
- :phpclass:`MongoDB\Client`

source/databases-collections.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ the ``test_database`` database:
6666

6767
To learn more about ``__get()`` and PHP magic methods, see the following resources:
6868

69-
- :phpmethod:`MongoDB\Client::__get()` in the API documentation
70-
- `Magic Methods <{+php-manual+}/language.oop5.magic.php>`__ in the PHP manual
69+
- :phpmethod:`MongoDB\Client::__get()` in the library API documentation
70+
- :php:`Magic Methods <language.oop5.magic>` in the PHP manual
7171

7272
.. _php-db-coll-access-collection:
7373

source/get-started/connect-to-mongodb.txt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,26 @@ the Atlas sample datasets.
2929

3030
.. step:: Assign the connection string
3131

32-
Replace the ``<connection string>`` placeholder with the
33-
connection string that you copied from the :ref:`php-connection-string`
34-
step of this guide.
32+
Assign the ``MONGODB_URI`` environment variable to the connection string that you copied
33+
from the :ref:`php-connection-string` step of this guide. You can assign this
34+
variable by running a shell command or creating a ``.env`` file in your application,
35+
as show in the following tabs:
36+
37+
.. tabs::
38+
39+
.. tab:: Shell Command
40+
:tabid: shell
41+
42+
.. code-block:: sh
43+
44+
export MONGODB_URI=<connection string>
45+
46+
.. tab:: .env File
47+
:tabid: dotenv
48+
49+
.. code-block:: none
50+
51+
MONGODB_URI=<connection string>
3552

3653
.. step:: Run your PHP application
3754

@@ -58,9 +75,9 @@ the Atlas sample datasets.
5875
...
5976
}
6077

61-
If you encounter an error or see no output, ensure that you specified the
62-
proper connection string in the ``quickstart.php`` file and that you loaded the
63-
sample data.
78+
If you encounter an error or see no output, ensure that you assigned the
79+
proper connection string to the ``MONGODB_URI`` environment variable and
80+
that you loaded the sample data.
6481

6582
After you complete these steps, you have a PHP application that
6683
connects to your MongoDB deployment, runs a query on the sample

source/get-started/next-steps.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ In this tutorial, you created a PHP application that
1717
connects to a MongoDB deployment hosted on MongoDB Atlas
1818
and retrieves a document that matches a query.
1919

20-
.. TODO:
21-
Learn more about the {+php-library+} from the following resources:
22-
- Learn how to perform read operations in the :ref:`<php-read>` section.
23-
- Learn how to perform write operations in the :ref:`<php-write>` section.
20+
21+
Learn more about the {+php-library+} from the following resources:
22+
23+
- Learn how to perform read operations in the :ref:`<php-read>` section.
24+
- Learn how to perform write operations in the :ref:`<php-write>` section.

source/includes/aggregation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$cursor = $collection->aggregate($pipeline);
1818

1919
foreach ($cursor as $doc) {
20-
echo json_encode($doc) , PHP_EOL;
20+
echo json_encode($doc), PHP_EOL;
2121
}
2222
// end-match-group
2323

@@ -35,6 +35,6 @@
3535
);
3636

3737
$result = $collection->explain($aggregate);
38-
echo json_encode($result) , PHP_EOL;
38+
echo json_encode($result), PHP_EOL;
3939
// end-explain
4040

source/includes/connect/atlas.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// Replace the placeholder with your Atlas connection string
4-
$uri = "<connection string>";
4+
$uri = '<connection string>';
55

66
// Create a MongoDB client with server API options
77
$client = new MongoDB\Client($uri, [], [
@@ -13,7 +13,6 @@
1313
$command = new MongoDB\Driver\Command(['ping' => 1]);
1414
$result = $admin->command($command)->toArray();
1515

16-
echo json_encode($result), "\n";
17-
echo "Pinged your deployment. You successfully connected to MongoDB!\n";
16+
echo json_encode($result), PHP_EOL;
17+
echo 'Pinged your deployment. You successfully connected to MongoDB!\n';
1818

19-
?>

source/includes/connect/ca-dir.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$uri = "mongodb://<hostname>:<port>";
1+
$uri = 'mongodb://<hostname>:<port>';
22

33
$uriOptions = [
44
'tls' => true,

source/includes/connect/ca-file-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsCAFile=/path/to/ca.pem";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCAFile=/path/to/ca.pem';
2323
$client = MongoDB\Client($uri);

source/includes/connect/client-cert-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem';
2323
$client = MongoDB\Client($uri);

source/includes/connect/crl-file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$uri = "mongodb://<hostname>:<port>";
1+
$uri = 'mongodb://<hostname>:<port>';
22

33
$uriOptions = [
44
'tls' => true,

source/includes/connect/crl-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsCRLFile=/path/to/crl.pem";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCRLFile=/path/to/crl.pem';
2323
$client = MongoDB\Client($uri);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// Replace the placeholders with your actual hostname and port
4-
$uri = "mongodb://<hostname>:<port>/?directConnection=true";
4+
$uri = 'mongodb://<hostname>:<port>/?directConnection=true';
55

66
// Create a MongoDB client
77
$client = new MongoDB\Client($uri);

source/includes/connect/disable-cert-validation-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidCertificates=true";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidCertificates=true';
2323
$client = MongoDB\Client($uri);

source/includes/connect/disable-host-verification-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidHostnames=true";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidHostnames=true';
2323
$client = MongoDB\Client($uri);

source/includes/connect/insecure-tls-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsInsecure=true";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsInsecure=true';
2323
$client = MongoDB\Client($uri);

source/includes/connect/key-file-password.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -20,5 +20,5 @@
2020

2121
.. code-block:: php
2222
23-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem&tlsCertificateKeyFilePassword=<passphrase>";
23+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem&tlsCertificateKeyFilePassword=<passphrase>';
2424
$client = MongoDB\Client($uri);

source/includes/connect/ocsp-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true,
@@ -19,5 +19,5 @@
1919

2020
.. code-block:: php
2121
22-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsDisableOCSPEndpointCheck=true";
22+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsDisableOCSPEndpointCheck=true';
2323
$client = MongoDB\Client($uri);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$uri = "mongodb://host1:27017/?replicaSet=sampleRS";
3+
$uri = 'mongodb://host1:27017/?replicaSet=sampleRS';
44

55
// Create a MongoDB client
66
$client = new MongoDB\Client($uri);

source/includes/connect/tls-tabs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.. code-block:: php
77
8-
$uri = "mongodb://<hostname>:<port>";
8+
$uri = 'mongodb://<hostname>:<port>';
99
1010
$options = [
1111
'tls' => true
@@ -18,5 +18,5 @@
1818

1919
.. code-block:: php
2020
21-
$uri = "mongodb://<hostname>:<port>/?tls=true";
21+
$uri = 'mongodb://<hostname>:<port>/?tls=true';
2222
$client = MongoDB\Client($uri);

source/includes/extracts-bucket-option.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ref: bucket-option-codec
22
content: |
3-
The :doc:`codec </tutorial/codecs>` to use for encoding or decoding documents.
3+
The :doc:`codec </data-formats/codecs>` to use for encoding or decoding documents.
44
This option is mutually exclusive with the ``typeMap`` option.
55
66
Defaults to the bucket's codec. Inheritance for a default ``codec`` option

source/includes/extracts-collection-option.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ref: collection-option-codec
22
content: |
3-
The :doc:`codec </tutorial/codecs>` to use for encoding or decoding documents.
3+
The :doc:`codec </data-formats/codecs>` to use for encoding or decoding documents.
44
This option is mutually exclusive with the ``typeMap`` option.
55
66
Defaults to the collection's codec. Inheritance for a default ``codec`` option

source/includes/extracts-common-option.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ref: common-option-codec
22
content: |
3-
The :doc:`codec </tutorial/codecs>` to use for encoding or decoding documents.
3+
The :doc:`codec </data-formats/codecs>` to use for encoding or decoding documents.
44
This option is mutually exclusive with the ``typeMap`` option.
55
---
66
ref: common-option-collation

source/includes/get-started/quickstart.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
use MongoDB\Client;
66

7-
$client = new Client('<connection string>');
7+
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException(
8+
'Set the MONGODB_URI environment variable to your Atlas URI'
9+
);
10+
$client = new MongoDB\Client($uri);
811
$collection = $client->sample_mflix->movies;
912

1013
$filter = ['title' => 'The Shawshank Redemption'];
@@ -13,5 +16,5 @@
1316
if ($result) {
1417
echo json_encode($result, JSON_PRETTY_PRINT);
1518
} else {
16-
echo "Document not found";
19+
echo 'Document not found';
1720
}

source/includes/indexes/indexes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
['title' => ['$regex' => 'Sunrise'],
4343
'year' => ['$gte' => 1990]]
4444
);
45-
echo json_encode($document) , PHP_EOL;
45+
echo json_encode($document), PHP_EOL;
4646
// end-compound-query
4747

4848
// start-multikey

0 commit comments

Comments
 (0)