From 491a06afc831f3e348a8a962b137c4efb0f4466e Mon Sep 17 00:00:00 2001 From: norareidy Date: Wed, 25 Sep 2024 12:09:34 -0400 Subject: [PATCH 01/15] DOCSP-43396: Cleanup --- source/aggregation.txt | 4 ++-- source/connect/client.txt | 2 +- source/connect/connection-targets.txt | 2 +- source/get-started/connect-to-mongodb.txt | 23 ++++++++++++++++++--- source/get-started/next-steps.txt | 9 ++++---- source/includes/get-started/quickstart.php | 5 ++++- source/includes/read/change-streams.php | 6 +++--- source/includes/read/count.php | 10 ++++----- source/includes/read/cursor.php | 4 ++-- source/includes/read/distinct.php | 6 +++--- source/includes/write/replace.php | 2 +- source/includes/write/update.php | 2 +- source/read/change-streams.txt | 8 +++---- source/read/count.txt | 6 +++--- source/read/cursor.txt | 12 +++++------ source/read/distinct.txt | 6 +++--- source/read/project.txt | 6 +++--- source/read/retrieve.txt | 20 ++++++++++-------- source/read/specify-a-query.txt | 10 ++++----- source/read/specify-documents-to-return.txt | 6 +++--- source/write/delete.txt | 6 +++--- source/write/insert.txt | 11 +++++----- source/write/replace.txt | 4 ++-- source/write/update.txt | 8 +++---- 24 files changed, 100 insertions(+), 78 deletions(-) diff --git a/source/aggregation.txt b/source/aggregation.txt index 1a677c95..96e7f63e 100644 --- a/source/aggregation.txt +++ b/source/aggregation.txt @@ -201,5 +201,5 @@ API Documentation To learn more about the methods discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::aggregate() <{+api+}/method/MongoDBCollection-aggregate/>`__ -- `MongoDB\\Collection::explain() <{+api+}/method/MongoDBCollection-explain/>`__ +- :phpmethod:`MongoDB\Collection::aggregate()` +- :phpmethod:`MongoDB\Collection::explain()` diff --git a/source/connect/client.txt b/source/connect/client.txt index 680d293b..bef37b50 100644 --- a/source/connect/client.txt +++ b/source/connect/client.txt @@ -102,4 +102,4 @@ API Documentation To learn more about creating a ``MongoDB\Client`` object in the {+library-short+}, see the following API documentation: -- :ref:`MongoDB\Client ` \ No newline at end of file +- :phpclass:`MongoDB\Client` \ No newline at end of file diff --git a/source/connect/connection-targets.txt b/source/connect/connection-targets.txt index ed4441c2..59497bb0 100644 --- a/source/connect/connection-targets.txt +++ b/source/connect/connection-targets.txt @@ -113,4 +113,4 @@ API Documentation To learn more about using the ``MongoDB\Client`` class, see the following API documentation: -- :ref:`MongoDB\Client ` \ No newline at end of file +- :phpclass:`MongoDB\Client` \ No newline at end of file diff --git a/source/get-started/connect-to-mongodb.txt b/source/get-started/connect-to-mongodb.txt index 7492fe25..a9f81a49 100644 --- a/source/get-started/connect-to-mongodb.txt +++ b/source/get-started/connect-to-mongodb.txt @@ -29,9 +29,26 @@ the Atlas sample datasets. .. step:: Assign the connection string - Replace the ```` placeholder with the - connection string that you copied from the :ref:`php-connection-string` - step of this guide. + Assign the ``MONGODB_URI`` environment variable to the connection string that you copied + from the :ref:`php-connection-string` step of this guide. You can assign this + variable by running a shell command or creating a ``.env`` file in your application, + as show in the following tabs: + + .. tabs:: + + .. tab:: Shell Command + :tabid: shell + + .. code-block:: sh + + export MONGODB_URI= + + .. tab:: .env File + :tabid: dotenv + + .. code-block:: php + + MONGODB_URI= .. step:: Run your PHP application diff --git a/source/get-started/next-steps.txt b/source/get-started/next-steps.txt index 3be97ed2..2fe8d5d5 100644 --- a/source/get-started/next-steps.txt +++ b/source/get-started/next-steps.txt @@ -17,7 +17,8 @@ In this tutorial, you created a PHP application that connects to a MongoDB deployment hosted on MongoDB Atlas and retrieves a document that matches a query. -.. TODO: - Learn more about the {+php-library+} from the following resources: - - Learn how to perform read operations in the :ref:`` section. - - Learn how to perform write operations in the :ref:`` section. \ No newline at end of file + +Learn more about the {+php-library+} from the following resources: + +- Learn how to perform read operations in the :ref:`` section. +- Learn how to perform write operations in the :ref:`` section. \ No newline at end of file diff --git a/source/includes/get-started/quickstart.php b/source/includes/get-started/quickstart.php index d62dd83e..4aeb0ec4 100644 --- a/source/includes/get-started/quickstart.php +++ b/source/includes/get-started/quickstart.php @@ -4,7 +4,10 @@ use MongoDB\Client; -$client = new Client(''); +$uri = getenv('MONGODB_URI') ?: throw new RuntimeException( + 'Set the MONGODB_URI environment variable to your Atlas URI' +); +$client = new MongoDB\Client($uri); $collection = $client->sample_mflix->movies; $filter = ['title' => 'The Shawshank Redemption']; diff --git a/source/includes/read/change-streams.php b/source/includes/read/change-streams.php index 5b51d1a6..b00ced02 100644 --- a/source/includes/read/change-streams.php +++ b/source/includes/read/change-streams.php @@ -24,7 +24,7 @@ function toJSON(object $document): string continue; } $event = $changeStream->current(); - echo toJSON($event) . PHP_EOL; + echo toJSON($event), PHP_EOL; if ($event['operationType'] === 'invalidate') { break; @@ -50,7 +50,7 @@ function toJSON(object $document): string continue; } $event = $changeStream->current(); - echo toJSON($event) . PHP_EOL; + echo toJSON($event), PHP_EOL; if ($event['operationType'] === 'invalidate') { break; @@ -68,7 +68,7 @@ function toJSON(object $document): string continue; } $event = $changeStream->current(); - echo toJSON($event) . PHP_EOL; + echo toJSON($event), PHP_EOL; if ($event['operationType'] === 'invalidate') { break; diff --git a/source/includes/read/count.php b/source/includes/read/count.php index 3167cb90..15bf6a09 100644 --- a/source/includes/read/count.php +++ b/source/includes/read/count.php @@ -13,13 +13,13 @@ // Counts all documents in the collection // start-count-all $result = $collection->countDocuments([]); -echo "Number of documents: " . $result; +echo "Number of documents: ", $result; // end-count-all // Counts documents that have a "founded_year" value of 2010 // start-count-accurate $result = $collection->countDocuments(['founded_year' => 2010]); -echo "Number of companies founded in 2010: " . $result; +echo "Number of companies founded in 2010: ", $result; // end-count-accurate // Counts a maximum of 100 documents that have a "number_of_employees" value of 50 @@ -28,17 +28,17 @@ ['number_of_employees' => 50], ['limit' => 100] ); -echo "Number of companies with 50 employees: " . $result; +echo "Number of companies with 50 employees: ", $result; // end-modify-accurate // Estimates the number of documents in the collection // start-count-estimate $result = $collection->estimatedDocumentCount(); -echo "Estimated number of documents: " . $result; +echo "Estimated number of documents: ", $result; // end-count-estimate // Estimates the number of documents in the collection and sets a time limit on the operation // start-modify-estimate $result = $collection->estimatedDocumentCount(['maxTimeMS' => 1000]); -echo "Estimated number of documents: " . $result; +echo "Estimated number of documents: ", $result; // end-modify-estimate diff --git a/source/includes/read/cursor.php b/source/includes/read/cursor.php index 7747a52c..7ea0648a 100644 --- a/source/includes/read/cursor.php +++ b/source/includes/read/cursor.php @@ -12,7 +12,7 @@ // start-cursor-iterate $cursor = $collection->find(['name' => 'Dunkin\' Donuts']); foreach ($cursor as $doc) { - echo json_encode($doc) . PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-cursor-iterate @@ -56,7 +56,7 @@ while ($docs_found < 3) { if ($cursor->valid()) { $doc = $cursor->current(); - echo json_encode($doc) . PHP_EOL; + echo json_encode($doc), PHP_EOL; $docs_found++; } $cursor->next(); diff --git a/source/includes/read/distinct.php b/source/includes/read/distinct.php index 5ac02f97..92745a3c 100644 --- a/source/includes/read/distinct.php +++ b/source/includes/read/distinct.php @@ -14,7 +14,7 @@ // start-distinct $results = $collection->distinct('borough', []); foreach ($results as $value) { - echo json_encode($value) . PHP_EOL; + echo json_encode($value), PHP_EOL; } // end-distinct @@ -22,7 +22,7 @@ // start-distinct-with-query $results = $collection->distinct('borough', ['cuisine' => 'Italian']); foreach ($results as $value) { - echo json_encode($value) . PHP_EOL; + echo json_encode($value), PHP_EOL; } // end-distinct-with-query @@ -34,7 +34,7 @@ $results = $collection->distinct('name', $query, $options); foreach ($results as $value) { - echo json_encode($value) . PHP_EOL; + echo json_encode($value), PHP_EOL; } // end-distinct-with-comment diff --git a/source/includes/write/replace.php b/source/includes/write/replace.php index 05a787c3..7c14c806 100644 --- a/source/includes/write/replace.php +++ b/source/includes/write/replace.php @@ -20,7 +20,7 @@ ]; $result = $collection->replaceOne(['name' => 'Pizza Town'], $replace_document); -echo 'Modified documents: ' . $result->getModifiedCount(); +echo 'Modified documents: ', $result->getModifiedCount(); // end-replace-one // start-replace-options diff --git a/source/includes/write/update.php b/source/includes/write/update.php index 2aee12b7..cd43f60c 100644 --- a/source/includes/write/update.php +++ b/source/includes/write/update.php @@ -40,6 +40,6 @@ ['name' => 'Dunkin\' Donuts'], ['$set' => ['name' => 'Dunkin\'']] ); -echo 'Modified documents: ' . $result->getModifiedCount(); +echo 'Modified documents: ', $result->getModifiedCount(); // end-update-result diff --git a/source/read/change-streams.txt b/source/read/change-streams.txt index 757c1e7b..37bc6340 100644 --- a/source/read/change-streams.txt +++ b/source/read/change-streams.txt @@ -262,7 +262,7 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Client::watch() <{+api+}/method/MongoDBClient-watch/>`__ -- `MongoDB\\Database::watch() <{+api+}/method/MongoDBDatabase-watch/>`__ -- `MongoDB\\Collection::watch() <{+api+}/method/MongoDBCollection-watch/>`__ -- `MongoDB\\Collection::updateOne() <{+api+}/method/MongoDBCollection-updateOne/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Client::watch()` +- :phpmethod:`MongoDB\Database::watch()` +- :phpmethod:`MongoDB\Collection::watch()` +- :phpmethod:`MongoDB\Collection::updateOne()` \ No newline at end of file diff --git a/source/read/count.txt b/source/read/count.txt index 20d7dd71..955f5393 100644 --- a/source/read/count.txt +++ b/source/read/count.txt @@ -36,7 +36,7 @@ Sample Data The examples in this guide use the ``companies`` collection in the ``sample_training`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/read/count.php :language: php @@ -248,5 +248,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::countDocuments() <{+api+}/method/MongoDBCollection-countDocuments/>`__ -- `MongoDB\\Collection::estimatedDocumentCount() <{+api+}/method/MongoDBCollection-estimatedDocumentCount/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::countDocuments()` +- :phpmethod:`MongoDB\Collection::estimatedDocumentCount()` \ No newline at end of file diff --git a/source/read/cursor.txt b/source/read/cursor.txt index 1fb36fb6..70fca7b1 100644 --- a/source/read/cursor.txt +++ b/source/read/cursor.txt @@ -174,15 +174,15 @@ Additional Information To learn more about read operations, see the :ref:`php-retrieve` guide. -To learn more about cursors, see the following pages in the PHP manual: +To learn more about cursors, see the following pages in the extension API documentation: -- `MongoDB\\Driver\\Cursor <{+php-manual+}/class.mongodb-driver-cursor.php>`__ -- `MongoDB\\Driver\\Cursor::current() <{+php-manual+}/mongodb-driver-cursor.current.php>`__ -- `MongoDB\\Driver\\Cursor::toArray() <{+php-manual+}/mongodb-driver-cursor.toarray.php>`__ -- `iterator_to_array() <{+php-manual+}/function.iterator-to-array.php>`__ +- :php:`MongoDB\Driver\Cursor ` +- :php:`MongoDB\Driver\Cursor::current() ` +- :php:`MongoDB\Driver\Cursor::toArray() ` +- :php:`iterator_to_array() ` API Documentation ~~~~~~~~~~~~~~~~~ To learn more about the ``find()`` method, see the API documentation for -`MongoDB\\Collection::find() <{+api+}/method/MongoDBCollection-find/>`__. \ No newline at end of file +:phpmethod:`MongoDB\Collection::find()`. \ No newline at end of file diff --git a/source/read/distinct.txt b/source/read/distinct.txt index 18b9de2f..3d24ef76 100644 --- a/source/read/distinct.txt +++ b/source/read/distinct.txt @@ -35,7 +35,7 @@ Sample Data The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/read/distinct.php :language: php @@ -167,5 +167,5 @@ in an options array to add a comment to the operation: API Documentation ----------------- -To learn more about the ``MongoDB\Collection::distinct()`` method, see the -`distinct() API documentation <{+api+}/method/MongoDBCollection-distinct/>`__. \ No newline at end of file +To learn more about the ``distinct()`` method, see +:phpmethod:`MongoDB\Collection::distinct()` in the API documentation. \ No newline at end of file diff --git a/source/read/project.txt b/source/read/project.txt index 7b568185..9c55b8f7 100644 --- a/source/read/project.txt +++ b/source/read/project.txt @@ -30,7 +30,7 @@ Sample Data The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/read/project.php :language: php @@ -168,5 +168,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::findOne() <{+api+}/method/MongoDBCollection-findOne/>`__ -- `MongoDB\\Collection::find() <{+api+}/method/MongoDBCollection-find/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::findOne()` +- :phpmethod:`MongoDB\Collection::find()` \ No newline at end of file diff --git a/source/read/retrieve.txt b/source/read/retrieve.txt index cd1507db..3908b0df 100644 --- a/source/read/retrieve.txt +++ b/source/read/retrieve.txt @@ -31,7 +31,7 @@ Sample Data The examples in this guide use the ``companies`` collection in the ``sample_training`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/read/retrieve.php :language: php @@ -52,7 +52,9 @@ The {+php-library+} includes two methods for retrieving documents from a collect take a **query filter** and return one or more matching documents. A query filter specifies the search criteria that the driver uses to retrieve documents in your query. -.. TODO: To learn more about query filters, see :ref:`php-specify-query`. +.. tip:: + + To learn more about query filters, see the :ref:`php-specify-query` guide. .. _php-retrieve-find-one: @@ -229,16 +231,16 @@ For a full list of options, see the API documentation for the Additional Information ---------------------- -.. TODO: - To learn more about query filters, see :ref:`php-specify-query`. - For runnable code examples of retrieving documents with the {+php-library+}, - see :ref:`php-read`. +To learn more about query filters, see the :ref:`php-specify-query` guide. + +To view code examples of retrieving documents with the {+php-library+}, +see :ref:`php-read`. API Documentation ~~~~~~~~~~~~~~~~~ -To learn more about any of the methods or types discussed in this +To learn more about any of the methods discussed in this guide, see the following API documentation: -- `findOne() <{+api+}/method/MongoDBCollection-findOne/>`__ -- `find() <{+api+}/method/MongoDBCollection-find/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::findOne()` +- :phpmethod:`MongoDB\Collection::find()` \ No newline at end of file diff --git a/source/read/specify-a-query.txt b/source/read/specify-a-query.txt index 9e38c2f6..53e00809 100644 --- a/source/read/specify-a-query.txt +++ b/source/read/specify-a-query.txt @@ -251,9 +251,9 @@ Additional Information To learn more about querying documents, see the :manual:`Query Documents ` guide in the {+mdb-server+} manual. -.. TODO: - To learn more about retrieving documents with the {+php-library+}, see the - :ref:`php-retrieve` guide. + +To learn more about retrieving documents with the {+php-library+}, see the +:ref:`php-retrieve` guide. API Documentation ~~~~~~~~~~~~~~~~~ @@ -261,5 +261,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::find() <{+api+}/method/MongoDBCollection-find/>`__ -- `MongoDB\\Collection::insertMany() <{+api+}/method/MongoDBCollection-insertMany/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::insertMany()` +- :phpmethod:`MongoDB\Collection::find()` \ No newline at end of file diff --git a/source/read/specify-documents-to-return.txt b/source/read/specify-documents-to-return.txt index 4497569f..ef3207c2 100644 --- a/source/read/specify-documents-to-return.txt +++ b/source/read/specify-documents-to-return.txt @@ -38,7 +38,7 @@ Sample Data The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/read/limit-skip-sort.php :language: php @@ -271,5 +271,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::findOne() <{+api+}/method/MongoDBCollection-findOne/>`__ -- `MongoDB\\Collection::find() <{+api+}/method/MongoDBCollection-find/>`__ +- :phpmethod:`MongoDB\Collection::findOne()` +- :phpmethod:`MongoDB\Collection::find()` diff --git a/source/write/delete.txt b/source/write/delete.txt index c45f16dd..2dd0cec1 100644 --- a/source/write/delete.txt +++ b/source/write/delete.txt @@ -194,6 +194,6 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::deleteOne() <{+api+}/method/MongoDBCollection-deleteOne/>`__ -- `MongoDB\\Collection::deleteMany() <{+api+}/method/MongoDBCollection-deleteMany/>`__ -- `MongoDB\\DeleteResult <{+api+}/class/MongoDBDeleteResult/>`__ +- :phpmethod:`MongoDB\Collection::deleteOne()` +- :phpmethod:`MongoDB\Collection::deleteMany()` +- :phpclass:`MongoDB\DeleteResult` diff --git a/source/write/insert.txt b/source/write/insert.txt index 340c9410..1a32d551 100644 --- a/source/write/insert.txt +++ b/source/write/insert.txt @@ -35,7 +35,7 @@ Sample Data The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/write/insert.php :language: php @@ -158,9 +158,8 @@ insert operation bypasses document-level validation: Additional Information ---------------------- -.. TODO: - For runnable code examples of inserting documents with the {+php-library+}, see - :ref:`php-write`. +To view runnable code examples of inserting documents with the {+php-library+}, see +:ref:`php-write`. API Documentation ~~~~~~~~~~~~~~~~~ @@ -168,5 +167,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::insertOne() <{+api+}/method/MongoDBCollection-insertOne/>`__ -- `MongoDB\\Collection::insertMany() <{+api+}/method/MongoDBCollection-insertMany/>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::insertOne()` +- :phpmethod:`MongoDB\Collection::insertMany()` \ No newline at end of file diff --git a/source/write/replace.txt b/source/write/replace.txt index 8e7909d6..ec433ea2 100644 --- a/source/write/replace.txt +++ b/source/write/replace.txt @@ -206,5 +206,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::replaceOne() <{+api+}/method/MongoDBCollection-replaceOne/>`__ -- `MongoDB\\UpdateResult <{+api+}/class/MongoDBUpdateResult/>`__ +- :phpmethod:`MongoDB\Collection::replaceOne()` +- :phpclass:`MongoDB\UpdateResult` diff --git a/source/write/update.txt b/source/write/update.txt index e07bde61..8f80a2fe 100644 --- a/source/write/update.txt +++ b/source/write/update.txt @@ -31,7 +31,7 @@ Sample Data The examples in this guide use the ``restaurants`` collection in the ``sample_restaurants`` database from the :atlas:`Atlas sample datasets `. To access this collection from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster -and assign the following value to your ``collection`` variable: +and assign the following value to your ``$collection`` variable: .. literalinclude:: /includes/write/update.php :language: php @@ -224,6 +224,6 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoDB\\Collection::updateOne() <{+api+}/method/MongoDBCollection-updateOne>`__ -- `MongoDB\\Collection::updateMany() <{+api+}/method/MongoDBCollection-updateMany>`__ -- `MongoDB\\UpdateResult <{+api+}/class/MongoDBUpdateResult>`__ \ No newline at end of file +- :phpmethod:`MongoDB\Collection::updateOne()` +- :phpmethod:`MongoDB\Collection::updateMany()` +- :phpclass:`MongoDB\UpdateResult` \ No newline at end of file From 809b53974adab39cb0e04348a006872a2208720f Mon Sep 17 00:00:00 2001 From: norareidy Date: Wed, 25 Sep 2024 17:12:21 -0400 Subject: [PATCH 02/15] quickstart fix --- source/get-started/connect-to-mongodb.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/get-started/connect-to-mongodb.txt b/source/get-started/connect-to-mongodb.txt index a9f81a49..a205c8c5 100644 --- a/source/get-started/connect-to-mongodb.txt +++ b/source/get-started/connect-to-mongodb.txt @@ -46,7 +46,7 @@ the Atlas sample datasets. .. tab:: .env File :tabid: dotenv - .. code-block:: php + .. code-block:: none MONGODB_URI= @@ -75,9 +75,9 @@ the Atlas sample datasets. ... } - If you encounter an error or see no output, ensure that you specified the - proper connection string in the ``quickstart.php`` file and that you loaded the - sample data. + If you encounter an error or see no output, ensure that you assigned the + proper connection string to the ``MONGODB_URI`` environment variable and + that you loaded the sample data. After you complete these steps, you have a PHP application that connects to your MongoDB deployment, runs a query on the sample From 785262a15ed347a185b5aea320d46e9236ece46d Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 13:23:17 -0400 Subject: [PATCH 03/15] code fixes --- source/includes/aggregation.php | 4 ++-- source/includes/connect/atlas.php | 7 +++---- source/includes/connect/ca-dir.php | 2 +- source/includes/connect/ca-file-tabs.rst | 4 ++-- source/includes/connect/client-cert-tabs.rst | 4 ++-- source/includes/connect/crl-file.php | 2 +- source/includes/connect/crl-tabs.rst | 4 ++-- source/includes/connect/direct-connection.php | 2 +- .../connect/disable-cert-validation-tabs.rst | 4 ++-- .../connect/disable-host-verification-tabs.rst | 4 ++-- source/includes/connect/insecure-tls-tabs.rst | 4 ++-- source/includes/connect/key-file-password.rst | 4 ++-- source/includes/connect/ocsp-tabs.rst | 4 ++-- source/includes/connect/replica-set.php | 2 +- source/includes/connect/tls-tabs.rst | 4 ++-- source/includes/get-started/quickstart.php | 2 +- source/includes/indexes/indexes.php | 2 +- source/includes/read/limit-skip-sort.php | 8 ++++---- source/includes/read/project.php | 6 +++--- source/includes/read/retrieve.php | 6 +++--- source/includes/read/specify-queries.php | 16 ++++++++-------- source/includes/write/delete.php | 2 +- 22 files changed, 48 insertions(+), 49 deletions(-) diff --git a/source/includes/aggregation.php b/source/includes/aggregation.php index e2cfa914..e8b1a7f9 100644 --- a/source/includes/aggregation.php +++ b/source/includes/aggregation.php @@ -17,7 +17,7 @@ $cursor = $collection->aggregate($pipeline); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-match-group @@ -35,6 +35,6 @@ ); $result = $collection->explain($aggregate); -echo json_encode($result) , PHP_EOL; +echo json_encode($result), PHP_EOL; // end-explain diff --git a/source/includes/connect/atlas.php b/source/includes/connect/atlas.php index 29d219d5..7bdf8fa3 100644 --- a/source/includes/connect/atlas.php +++ b/source/includes/connect/atlas.php @@ -1,7 +1,7 @@ "; +$uri = ''; // Create a MongoDB client with server API options $client = new MongoDB\Client($uri, [], [ @@ -13,7 +13,6 @@ $command = new MongoDB\Driver\Command(['ping' => 1]); $result = $admin->command($command)->toArray(); -echo json_encode($result), "\n"; -echo "Pinged your deployment. You successfully connected to MongoDB!\n"; +echo json_encode($result), '\n'; +echo 'Pinged your deployment. You successfully connected to MongoDB!\n'; -?> diff --git a/source/includes/connect/ca-dir.php b/source/includes/connect/ca-dir.php index 3618529b..03e88108 100644 --- a/source/includes/connect/ca-dir.php +++ b/source/includes/connect/ca-dir.php @@ -1,4 +1,4 @@ -$uri = "mongodb://:"; +$uri = 'mongodb://:'; $uriOptions = [ 'tls' => true, diff --git a/source/includes/connect/ca-file-tabs.rst b/source/includes/connect/ca-file-tabs.rst index b0b85bc8..57bfd343 100644 --- a/source/includes/connect/ca-file-tabs.rst +++ b/source/includes/connect/ca-file-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsCAFile=/path/to/ca.pem"; + $uri = 'mongodb://:/?tls=true&tlsCAFile=/path/to/ca.pem'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/client-cert-tabs.rst b/source/includes/connect/client-cert-tabs.rst index 961fc987..a93a9185 100644 --- a/source/includes/connect/client-cert-tabs.rst +++ b/source/includes/connect/client-cert-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsCertificateKeyFile=/path/to/client.pem"; + $uri = 'mongodb://:/?tls=true&tlsCertificateKeyFile=/path/to/client.pem'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/crl-file.php b/source/includes/connect/crl-file.php index 1a37b5e2..8904c0e4 100644 --- a/source/includes/connect/crl-file.php +++ b/source/includes/connect/crl-file.php @@ -1,4 +1,4 @@ -$uri = "mongodb://:"; +$uri = 'mongodb://:'; $uriOptions = [ 'tls' => true, diff --git a/source/includes/connect/crl-tabs.rst b/source/includes/connect/crl-tabs.rst index f0a63f9d..3784ce06 100644 --- a/source/includes/connect/crl-tabs.rst +++ b/source/includes/connect/crl-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsCRLFile=/path/to/crl.pem"; + $uri = 'mongodb://:/?tls=true&tlsCRLFile=/path/to/crl.pem'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/direct-connection.php b/source/includes/connect/direct-connection.php index fd896b3c..665bc3ae 100644 --- a/source/includes/connect/direct-connection.php +++ b/source/includes/connect/direct-connection.php @@ -1,7 +1,7 @@ :/?directConnection=true"; +$uri = 'mongodb://:/?directConnection=true'; // Create a MongoDB client $client = new MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/disable-cert-validation-tabs.rst b/source/includes/connect/disable-cert-validation-tabs.rst index bcdc0e76..60e77093 100644 --- a/source/includes/connect/disable-cert-validation-tabs.rst +++ b/source/includes/connect/disable-cert-validation-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsAllowInvalidCertificates=true"; + $uri = 'mongodb://:/?tls=true&tlsAllowInvalidCertificates=true'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/disable-host-verification-tabs.rst b/source/includes/connect/disable-host-verification-tabs.rst index db4b8d1b..96cc4cfc 100644 --- a/source/includes/connect/disable-host-verification-tabs.rst +++ b/source/includes/connect/disable-host-verification-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsAllowInvalidHostnames=true"; + $uri = 'mongodb://:/?tls=true&tlsAllowInvalidHostnames=true'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/insecure-tls-tabs.rst b/source/includes/connect/insecure-tls-tabs.rst index 97600fbf..e04e56ea 100644 --- a/source/includes/connect/insecure-tls-tabs.rst +++ b/source/includes/connect/insecure-tls-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsInsecure=true"; + $uri = 'mongodb://:/?tls=true&tlsInsecure=true'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/key-file-password.rst b/source/includes/connect/key-file-password.rst index 2cb710c9..a6b2f8ea 100644 --- a/source/includes/connect/key-file-password.rst +++ b/source/includes/connect/key-file-password.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -20,5 +20,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsCertificateKeyFile=/path/to/client.pem&tlsCertificateKeyFilePassword="; + $uri = 'mongodb://:/?tls=true&tlsCertificateKeyFile=/path/to/client.pem&tlsCertificateKeyFilePassword='; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/ocsp-tabs.rst b/source/includes/connect/ocsp-tabs.rst index 1e393689..467fed14 100644 --- a/source/includes/connect/ocsp-tabs.rst +++ b/source/includes/connect/ocsp-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: php - $uri = "mongodb://:"; + $uri = 'mongodb://:'; $options = [ 'tls' => true, @@ -19,5 +19,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true&tlsDisableOCSPEndpointCheck=true"; + $uri = 'mongodb://:/?tls=true&tlsDisableOCSPEndpointCheck=true'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/connect/replica-set.php b/source/includes/connect/replica-set.php index 6086d425..cd8840fb 100644 --- a/source/includes/connect/replica-set.php +++ b/source/includes/connect/replica-set.php @@ -1,6 +1,6 @@ :"; + $uri = 'mongodb://:'; $options = [ 'tls' => true @@ -18,5 +18,5 @@ .. code-block:: php - $uri = "mongodb://:/?tls=true"; + $uri = 'mongodb://:/?tls=true'; $client = MongoDB\Client($uri); \ No newline at end of file diff --git a/source/includes/get-started/quickstart.php b/source/includes/get-started/quickstart.php index 4aeb0ec4..a5b3abb0 100644 --- a/source/includes/get-started/quickstart.php +++ b/source/includes/get-started/quickstart.php @@ -16,5 +16,5 @@ if ($result) { echo json_encode($result, JSON_PRETTY_PRINT); } else { - echo "Document not found"; + echo "Document not found'; } diff --git a/source/includes/indexes/indexes.php b/source/includes/indexes/indexes.php index 235e3ee5..3b293fb1 100644 --- a/source/includes/indexes/indexes.php +++ b/source/includes/indexes/indexes.php @@ -42,7 +42,7 @@ ['title' => ['$regex' => 'Sunrise'], 'year' => ['$gte' => 1990]] ); -echo json_encode($document) , PHP_EOL; +echo json_encode($document), PHP_EOL; // end-compound-query // start-multikey diff --git a/source/includes/read/limit-skip-sort.php b/source/includes/read/limit-skip-sort.php index 8beec933..433a6e6b 100644 --- a/source/includes/read/limit-skip-sort.php +++ b/source/includes/read/limit-skip-sort.php @@ -17,7 +17,7 @@ ); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-limit @@ -29,7 +29,7 @@ ); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-sort @@ -41,7 +41,7 @@ ); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-skip @@ -56,7 +56,7 @@ $cursor = $collection->find(['cuisine' => 'Italian'], $options); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-limit-sort-skip diff --git a/source/includes/read/project.php b/source/includes/read/project.php index 3f63d93b..c601402f 100644 --- a/source/includes/read/project.php +++ b/source/includes/read/project.php @@ -21,7 +21,7 @@ $cursor = $collection->find(['name' => 'Emerald Pub'], $options); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-project-include @@ -39,7 +39,7 @@ $cursor = $collection->find(['name' => 'Emerald Pub'], $options); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-project-include-without-id @@ -54,6 +54,6 @@ $cursor = $collection->find(['name' => 'Emerald Pub'], $options); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-project-exclude diff --git a/source/includes/read/retrieve.php b/source/includes/read/retrieve.php index ed086984..bc4646b7 100644 --- a/source/includes/read/retrieve.php +++ b/source/includes/read/retrieve.php @@ -11,7 +11,7 @@ // Finds one document with a "name" value of "LinkedIn" // start-find-one $document = $collection->findOne(['name' => 'LinkedIn']); -echo json_encode($document) , "\n"; +echo json_encode($document), "\n"; // end-find-one // Finds documents with a "founded_year" value of 1970 @@ -22,7 +22,7 @@ // Prints documents with a "founded_year" value of 1970 // start-cursor foreach ($results as $doc) { - echo json_encode($doc) , "\n"; + echo json_encode($doc), "\n"; } // end-cursor @@ -34,6 +34,6 @@ ); foreach ($results as $doc) { - echo json_encode($doc) , "\n"; + echo json_encode($doc), "\n"; } // end-modify diff --git a/source/includes/read/specify-queries.php b/source/includes/read/specify-queries.php index df7e1c11..27ce4ebd 100644 --- a/source/includes/read/specify-queries.php +++ b/source/includes/read/specify-queries.php @@ -5,7 +5,7 @@ use MongoDB\Client; // start-setup -$uri = ""; +$uri = ''; $client = new Client($uri); $collection = $client->db->fruits; @@ -50,7 +50,7 @@ // start-find-exact $cursor = $collection->find(['color' => 'yellow']); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-exact @@ -58,7 +58,7 @@ // start-find-all $cursor = $collection->find([]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-all @@ -66,7 +66,7 @@ // start-find-comparison $cursor = $collection->find(['rating' => ['$gt' => 2]]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-comparison @@ -79,7 +79,7 @@ ] ]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-logical @@ -87,7 +87,7 @@ // start-find-array $cursor = $collection->find(['type' => ['$size' => 2]]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-array @@ -95,7 +95,7 @@ // start-find-element $cursor = $collection->find(['color' => ['$exists' => true]]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-element @@ -103,6 +103,6 @@ // start-find-evaluation $cursor = $collection->find(['name' => ['$regex' => 'p{2,}']]); foreach ($cursor as $doc) { - echo json_encode($doc) , PHP_EOL; + echo json_encode($doc), PHP_EOL; } // end-find-evaluation diff --git a/source/includes/write/delete.php b/source/includes/write/delete.php index 50a5f910..bab197a6 100644 --- a/source/includes/write/delete.php +++ b/source/includes/write/delete.php @@ -29,6 +29,6 @@ // Deletes and prints the number of documents that have a "cuisine" value of "Greek" // start-delete-count $result = $collection->deleteMany(['cuisine' => 'Greek']); -echo 'Deleted documents: ' , $result->getDeletedCount() , PHP_EOL; +echo 'Deleted documents: ', $result->getDeletedCount(), PHP_EOL; // end-delete-count From c654e6bbf237de9c854027c1b0aa3013ee15aa32 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 13:25:45 -0400 Subject: [PATCH 04/15] edit --- source/includes/connect/atlas.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/includes/connect/atlas.php b/source/includes/connect/atlas.php index 7bdf8fa3..36f9c5d4 100644 --- a/source/includes/connect/atlas.php +++ b/source/includes/connect/atlas.php @@ -13,6 +13,6 @@ $command = new MongoDB\Driver\Command(['ping' => 1]); $result = $admin->command($command)->toArray(); -echo json_encode($result), '\n'; +echo json_encode($result), "\n"; echo 'Pinged your deployment. You successfully connected to MongoDB!\n'; From be667e638512710de10768f8356b17587b1de385 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 13:30:45 -0400 Subject: [PATCH 05/15] snooty --- snooty.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snooty.toml b/snooty.toml index 76e5f009..d2d18efa 100644 --- a/snooty.toml +++ b/snooty.toml @@ -26,7 +26,7 @@ toc_landing_pages = [ "/databases-collections", "/write", "/indexes", - "/security" + "/security", "/data-formats" ] From ef6903892cfa79be2a83d55067b01f87e7c4236d Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 13:36:23 -0400 Subject: [PATCH 06/15] edit --- source/connect.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/connect.txt b/source/connect.txt index cc4ff021..f318d559 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -25,11 +25,11 @@ Connect to MongoDB /connect/client /connect/connection-targets /connect/tls + /connect/stable-api .. TODO: /connect/connection-options - /connect/stable-api - + Overview -------- From 1b87a90df2faf13d8b2cd767c09af903d810fdbb Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 13:43:47 -0400 Subject: [PATCH 07/15] code output --- source/read/distinct.txt | 1 + source/read/retrieve.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/source/read/distinct.txt b/source/read/distinct.txt index 3d24ef76..31d88bd5 100644 --- a/source/read/distinct.txt +++ b/source/read/distinct.txt @@ -68,6 +68,7 @@ the ``restaurants`` collection: :dedent: .. output:: + :visible: false "Bronx" "Manhattan" diff --git a/source/read/retrieve.txt b/source/read/retrieve.txt index 3908b0df..58a032f5 100644 --- a/source/read/retrieve.txt +++ b/source/read/retrieve.txt @@ -90,6 +90,7 @@ the ``name`` field has the value ``'LinkedIn'``: :dedent: .. output:: + :visible: false {"_id":{"$oid":"..."},"name":"LinkedIn","permalink":"linkedin","crunchbase_url": "http:\/\/www.crunchbase.com\/company\/linkedin","homepage_url":"http:\/\/linkedin.com", @@ -138,6 +139,7 @@ the following example: :dedent: .. output:: + :visible: false {"_id":{"$oid":"..."},"name":"Mitsubishi Motors","permalink":"mitsubishi-motors", "crunchbase_url":"http:\/\/www.crunchbase.com\/company\/mitsubishi-motors", From 6ea7b825af3586b581d33a46889ab741d26a994a Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 14:18:49 -0400 Subject: [PATCH 08/15] build log errors --- source/includes/extracts-bucket-option.yaml | 2 +- source/includes/extracts-collection-option.yaml | 2 +- source/includes/extracts-common-option.yaml | 2 +- source/read/cursor.txt | 2 ++ .../method/MongoDBClient-selectCollection.txt | 2 +- .../method/MongoDBCollection-bulkWrite.txt | 2 +- .../method/MongoDBCollection-createIndex.txt | 2 +- .../method/MongoDBCollection-createIndexes.txt | 2 +- .../method/MongoDBCollection-deleteMany.txt | 2 +- .../method/MongoDBCollection-deleteOne.txt | 2 +- .../method/MongoDBCollection-dropIndex.txt | 2 +- .../method/MongoDBCollection-dropIndexes.txt | 2 +- .../method/MongoDBCollection-insertMany.txt | 2 +- .../method/MongoDBCollection-insertOne.txt | 2 +- .../method/MongoDBCollection-listIndexes.txt | 2 +- .../method/MongoDBCollection-replaceOne.txt | 2 +- .../method/MongoDBCollection-updateMany.txt | 2 +- .../method/MongoDBCollection-updateOne.txt | 2 +- .../method/MongoDBCollection-withOptions.txt | 2 +- .../method/MongoDBCollection__construct.txt | 2 +- .../method/MongoDBDatabase-selectCollection.txt | 2 +- .../MongoDBDatabase-selectGridFSBucket.txt | 2 +- .../method/MongoDBGridFSBucket__construct.txt | 2 +- source/security.txt | 16 ++++++++++------ source/security/authentication.txt | 2 +- source/tutorial.txt | 4 ++-- 26 files changed, 37 insertions(+), 31 deletions(-) diff --git a/source/includes/extracts-bucket-option.yaml b/source/includes/extracts-bucket-option.yaml index a3eb915f..1ca8a553 100644 --- a/source/includes/extracts-bucket-option.yaml +++ b/source/includes/extracts-bucket-option.yaml @@ -1,6 +1,6 @@ ref: bucket-option-codec content: | - The :doc:`codec ` to use for encoding or decoding documents. + The :doc:`codec ` to use for encoding or decoding documents. This option is mutually exclusive with the ``typeMap`` option. Defaults to the bucket's codec. Inheritance for a default ``codec`` option diff --git a/source/includes/extracts-collection-option.yaml b/source/includes/extracts-collection-option.yaml index ecc82a42..c293dc62 100644 --- a/source/includes/extracts-collection-option.yaml +++ b/source/includes/extracts-collection-option.yaml @@ -1,6 +1,6 @@ ref: collection-option-codec content: | - The :doc:`codec ` to use for encoding or decoding documents. + The :doc:`codec ` to use for encoding or decoding documents. This option is mutually exclusive with the ``typeMap`` option. Defaults to the collection's codec. Inheritance for a default ``codec`` option diff --git a/source/includes/extracts-common-option.yaml b/source/includes/extracts-common-option.yaml index 39cab355..68702d6e 100644 --- a/source/includes/extracts-common-option.yaml +++ b/source/includes/extracts-common-option.yaml @@ -1,6 +1,6 @@ ref: common-option-codec content: | - The :doc:`codec ` to use for encoding or decoding documents. + The :doc:`codec ` to use for encoding or decoding documents. This option is mutually exclusive with the ``typeMap`` option. --- ref: common-option-collation diff --git a/source/read/cursor.txt b/source/read/cursor.txt index 70fca7b1..2ecee070 100644 --- a/source/read/cursor.txt +++ b/source/read/cursor.txt @@ -127,6 +127,8 @@ in an array: :start-after: start-cursor-array :end-before: end-cursor-array +.. _php-tailable-cursor: + Tailable Cursors ---------------- diff --git a/source/reference/method/MongoDBClient-selectCollection.txt b/source/reference/method/MongoDBClient-selectCollection.txt index c1984500..b45b83dd 100644 --- a/source/reference/method/MongoDBClient-selectCollection.txt +++ b/source/reference/method/MongoDBClient-selectCollection.txt @@ -47,7 +47,7 @@ Parameters * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for collection + - The default :doc:`codec ` to use for collection operations. .. versionadded:: 1.17 diff --git a/source/reference/method/MongoDBCollection-bulkWrite.txt b/source/reference/method/MongoDBCollection-bulkWrite.txt index ad31f062..1f273e76 100644 --- a/source/reference/method/MongoDBCollection-bulkWrite.txt +++ b/source/reference/method/MongoDBCollection-bulkWrite.txt @@ -147,4 +147,4 @@ See Also - :phpmethod:`MongoDB\Collection::replaceOne()` - :phpmethod:`MongoDB\Collection::updateMany()` - :phpmethod:`MongoDB\Collection::updateOne()` -- :doc:`/tutorial/crud` +- :ref:`php-write` diff --git a/source/reference/method/MongoDBCollection-createIndex.txt b/source/reference/method/MongoDBCollection-createIndex.txt index 6a74a5bd..108d12f6 100644 --- a/source/reference/method/MongoDBCollection-createIndex.txt +++ b/source/reference/method/MongoDBCollection-createIndex.txt @@ -201,7 +201,7 @@ See Also -------- - :phpmethod:`MongoDB\Collection::createIndexes()` -- :doc:`/tutorial/indexes` +- :ref:`php-indexes` - :manual:`createIndexes ` command reference in the MongoDB manual - :manual:`Index ` documentation in the MongoDB Manual diff --git a/source/reference/method/MongoDBCollection-createIndexes.txt b/source/reference/method/MongoDBCollection-createIndexes.txt index 85318b2d..4357a9f7 100644 --- a/source/reference/method/MongoDBCollection-createIndexes.txt +++ b/source/reference/method/MongoDBCollection-createIndexes.txt @@ -167,7 +167,7 @@ See Also -------- - :phpmethod:`MongoDB\Collection::createIndex()` -- :doc:`/tutorial/indexes` +- :ref:`php-indexes` - :manual:`createIndexes ` command reference in the MongoDB manual - :manual:`Index ` documentation in the MongoDB Manual diff --git a/source/reference/method/MongoDBCollection-deleteMany.txt b/source/reference/method/MongoDBCollection-deleteMany.txt index b82b1c6b..d30a169d 100644 --- a/source/reference/method/MongoDBCollection-deleteMany.txt +++ b/source/reference/method/MongoDBCollection-deleteMany.txt @@ -129,6 +129,6 @@ See Also - :phpmethod:`MongoDB\Collection::deleteOne()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-delete` - :manual:`delete ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-deleteOne.txt b/source/reference/method/MongoDBCollection-deleteOne.txt index 43209ebd..8013193f 100644 --- a/source/reference/method/MongoDBCollection-deleteOne.txt +++ b/source/reference/method/MongoDBCollection-deleteOne.txt @@ -131,6 +131,6 @@ See Also - :phpmethod:`MongoDB\Collection::deleteMany()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-delete` - :manual:`delete ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-dropIndex.txt b/source/reference/method/MongoDBCollection-dropIndex.txt index d1aa937c..c8c6e643 100644 --- a/source/reference/method/MongoDBCollection-dropIndex.txt +++ b/source/reference/method/MongoDBCollection-dropIndex.txt @@ -122,7 +122,7 @@ See Also -------- - :phpmethod:`MongoDB\Collection::dropIndexes()` -- :doc:`/tutorial/indexes` +- :ref:`php-indexes` - :manual:`dropIndexes ` command reference in the MongoDB manual - :manual:`Index documentation ` in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-dropIndexes.txt b/source/reference/method/MongoDBCollection-dropIndexes.txt index 32c1c134..fc7bc1c2 100644 --- a/source/reference/method/MongoDBCollection-dropIndexes.txt +++ b/source/reference/method/MongoDBCollection-dropIndexes.txt @@ -122,7 +122,7 @@ See Also -------- - :phpmethod:`MongoDB\Collection::dropIndex()` -- :doc:`/tutorial/indexes` +- :ref:`php-indexes` - :manual:`dropIndexes ` command reference in the MongoDB manual - :manual:`Index documentation ` in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-insertMany.txt b/source/reference/method/MongoDBCollection-insertMany.txt index bcaec509..8362558e 100644 --- a/source/reference/method/MongoDBCollection-insertMany.txt +++ b/source/reference/method/MongoDBCollection-insertMany.txt @@ -157,6 +157,6 @@ See Also - :phpmethod:`MongoDB\Collection::insertOne()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-insert` - :manual:`insert ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-insertOne.txt b/source/reference/method/MongoDBCollection-insertOne.txt index d4b0d0de..b3bc98da 100644 --- a/source/reference/method/MongoDBCollection-insertOne.txt +++ b/source/reference/method/MongoDBCollection-insertOne.txt @@ -131,6 +131,6 @@ See Also - :phpmethod:`MongoDB\Collection::insertMany()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-insert` - :manual:`insert ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-listIndexes.txt b/source/reference/method/MongoDBCollection-listIndexes.txt index b65b228b..c6d9d474 100644 --- a/source/reference/method/MongoDBCollection-listIndexes.txt +++ b/source/reference/method/MongoDBCollection-listIndexes.txt @@ -128,7 +128,7 @@ The output would then resemble: See Also -------- -- :doc:`/tutorial/indexes` +- :ref:`php-indexes` - :manual:`listIndexes ` command reference in the MongoDB manual - :manual:`Index documentation ` in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-replaceOne.txt b/source/reference/method/MongoDBCollection-replaceOne.txt index 7a5444a1..b774fcdc 100644 --- a/source/reference/method/MongoDBCollection-replaceOne.txt +++ b/source/reference/method/MongoDBCollection-replaceOne.txt @@ -161,6 +161,6 @@ See Also - :phpmethod:`MongoDB\Collection::updateMany()` - :phpmethod:`MongoDB\Collection::updateOne()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-replace` - :manual:`update ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-updateMany.txt b/source/reference/method/MongoDBCollection-updateMany.txt index 0ada743b..e2c95b9b 100644 --- a/source/reference/method/MongoDBCollection-updateMany.txt +++ b/source/reference/method/MongoDBCollection-updateMany.txt @@ -158,6 +158,6 @@ See Also - :phpmethod:`MongoDB\Collection::replaceOne()` - :phpmethod:`MongoDB\Collection::updateOne()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-update` - :manual:`update ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-updateOne.txt b/source/reference/method/MongoDBCollection-updateOne.txt index 42877e73..27000edc 100644 --- a/source/reference/method/MongoDBCollection-updateOne.txt +++ b/source/reference/method/MongoDBCollection-updateOne.txt @@ -160,6 +160,6 @@ See Also - :phpmethod:`MongoDB\Collection::replaceOne()` - :phpmethod:`MongoDB\Collection::updateMany()` - :phpmethod:`MongoDB\Collection::bulkWrite()` -- :doc:`/tutorial/crud` +- :ref:`php-write-update` - :manual:`update ` command reference in the MongoDB manual diff --git a/source/reference/method/MongoDBCollection-withOptions.txt b/source/reference/method/MongoDBCollection-withOptions.txt index 8123904b..0b9531ac 100644 --- a/source/reference/method/MongoDBCollection-withOptions.txt +++ b/source/reference/method/MongoDBCollection-withOptions.txt @@ -37,7 +37,7 @@ Parameters * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for collection + - The default :doc:`codec ` to use for collection operations. Defaults to the original collection's codec. .. versionadded:: 1.17 diff --git a/source/reference/method/MongoDBCollection__construct.txt b/source/reference/method/MongoDBCollection__construct.txt index a7480447..c9ee112d 100644 --- a/source/reference/method/MongoDBCollection__construct.txt +++ b/source/reference/method/MongoDBCollection__construct.txt @@ -51,7 +51,7 @@ Definition * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for collection + - The default :doc:`codec ` to use for collection operations. .. versionadded:: 1.17 diff --git a/source/reference/method/MongoDBDatabase-selectCollection.txt b/source/reference/method/MongoDBDatabase-selectCollection.txt index b88179cd..237e38cf 100644 --- a/source/reference/method/MongoDBDatabase-selectCollection.txt +++ b/source/reference/method/MongoDBDatabase-selectCollection.txt @@ -43,7 +43,7 @@ Parameters * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for collection + - The default :doc:`codec ` to use for collection operations. .. versionadded:: 1.17 diff --git a/source/reference/method/MongoDBDatabase-selectGridFSBucket.txt b/source/reference/method/MongoDBDatabase-selectGridFSBucket.txt index 2f42b6ff..5bd11d25 100644 --- a/source/reference/method/MongoDBDatabase-selectGridFSBucket.txt +++ b/source/reference/method/MongoDBDatabase-selectGridFSBucket.txt @@ -46,7 +46,7 @@ Parameters * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for bucket methods + - The default :doc:`codec ` to use for bucket methods that return a file document (e.g. :phpmethod:`MongoDB\GridFS\Bucket::find()`). .. versionadded:: 1.17 diff --git a/source/reference/method/MongoDBGridFSBucket__construct.txt b/source/reference/method/MongoDBGridFSBucket__construct.txt index 1349e5f4..8bc64f09 100644 --- a/source/reference/method/MongoDBGridFSBucket__construct.txt +++ b/source/reference/method/MongoDBGridFSBucket__construct.txt @@ -57,7 +57,7 @@ Parameters * - codec - MongoDB\\Codec\\DocumentCodec - - The default :doc:`codec ` to use for bucket methods + - The default :doc:`codec ` to use for bucket methods that return a file document (e.g. :phpmethod:`MongoDB\GridFS\Bucket::find()`). .. versionadded:: 1.17 diff --git a/source/security.txt b/source/security.txt index 485595de..8c8e236b 100644 --- a/source/security.txt +++ b/source/security.txt @@ -135,7 +135,7 @@ the ``X.509`` authentication mechanism: :start-after: start-mongodb-X509-uri :end-before: end-mongodb-X509-uri -To learn more about X.509 authentication, see :ref:`php-x509` in +To learn more about X.509 authentication, see :ref:`php-mongodb-x509` in the Authentication guide. MONGODB-AWS @@ -155,7 +155,7 @@ attempts to retrieve your AWS credentials from the following sources, in the ord Each section shows how to authenticate with ``MONGODB-AWS`` when retrieving your AWS credentials from options passed to your client or the alternative external sources. -To learn more about authenticating with AWS, see :ref:`php-mongo-aws` in the +To learn more about authenticating with AWS, see :ref:`php-mongodb-aws` in the Authentication guide. MongoDB\\Client Credentials @@ -184,6 +184,10 @@ to authenticate with ``MONGODB-AWS``: :start-after: start-mongodb-aws-uri :end-before: end-mongodb-aws-uri +To learn more about authenticating with AWS by retrieving ``MongoDB\Client`` +credentials, see :ref:`php-mongodb-aws-credentials` in the Authentication +guide. + External Credentials ~~~~~~~~~~~~~~~~~~~~ @@ -214,7 +218,7 @@ request, ECS metadata, or EC2 instance metadata: To learn more about authenticating with AWS by obtaining external credentials, see the following sections in the Authentication guide: -- :ref:`php-mongo-aws-environment` -- :ref:`php-mongo-aws-assume-role` -- :ref:`php-mongo-aws-ecs` -- :ref:`php-mongo-aws-ec2` +- :ref:`php-mongodb-aws-env-vars` +- :ref:`php-mongodb-aws-oidc` +- :ref:`php-mongodb-aws-ecs` +- :ref:`php-mongodb-aws-ec2` diff --git a/source/security/authentication.txt b/source/security/authentication.txt index 13050e19..e02b9e2d 100644 --- a/source/security/authentication.txt +++ b/source/security/authentication.txt @@ -355,7 +355,7 @@ connection option to ``'MONGODB-AWS'``. To view an example that sets the ``authMechanism`` option, see the :ref:`authMechanism example ` on this page. -.. _php-mongo-aws-ec2: +.. _php-mongodb-aws-ec2: EC2 Instance Metadata ~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/tutorial.txt b/source/tutorial.txt index 4ea6c7fa..3102405c 100644 --- a/source/tutorial.txt +++ b/source/tutorial.txt @@ -9,8 +9,8 @@ Tutorials /tutorial/connecting /tutorial/server-selection - /tutorial/crud - /tutorial/codecs + /data-formats/crud + /data-formats/codecs /tutorial/collation /tutorial/commands /tutorial/custom-types From 4de73cdf09e908db0c1bf1c9d52d1225270bca40 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 14:24:57 -0400 Subject: [PATCH 09/15] another build fix --- source/reference/method/MongoDBCollection-getNamespace.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/reference/method/MongoDBCollection-getNamespace.txt b/source/reference/method/MongoDBCollection-getNamespace.txt index 4003fbd8..3b055c7b 100644 --- a/source/reference/method/MongoDBCollection-getNamespace.txt +++ b/source/reference/method/MongoDBCollection-getNamespace.txt @@ -15,8 +15,9 @@ Definition .. phpmethod:: MongoDB\Collection::getNamespace() - Returns the :term:`namespace` of the collection. A namespace is the canonical - name of an index or collection in MongoDB. + Returns the :manual:`namespace ` + of the collection. A namespace is the canonical name of an index or collection + in MongoDB. .. code-block:: php From 4d73c4300ded6221d62301b3c07b6e14022b9f67 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 26 Sep 2024 14:44:34 -0400 Subject: [PATCH 10/15] add info --- source/index.txt | 6 ++++++ source/security/authentication.txt | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/index.txt b/source/index.txt index f8d9c36f..8ef51aab 100644 --- a/source/index.txt +++ b/source/index.txt @@ -68,6 +68,12 @@ Write Data to MongoDB Learn how you can write data to MongoDB in the :ref:`php-write` section. +Specify How CRUD Operations Run on Replica Sets +----------------------------------------------- + +Learn how to configure settings for read and write operations on replica +sets in the :ref:`php-read-write-pref` section. + Transform Your Data with Aggregation ------------------------------------ diff --git a/source/security/authentication.txt b/source/security/authentication.txt index e02b9e2d..ad94d788 100644 --- a/source/security/authentication.txt +++ b/source/security/authentication.txt @@ -174,8 +174,8 @@ these sources and use them to authenticate your PHP application. .. _php-mongodb-aws-credentials: -MongoDB\Client Credentials -~~~~~~~~~~~~~~~~~~~~~~~~~~ +MongoDB\\Client Credentials +~~~~~~~~~~~~~~~~~~~~~~~~~~~ First, the driver checks whether you passed AWS credentials to the ``MongoDB\Client`` constructor, either as as part of the connection From 114801e95dc0608d86182f34e53ca2856545cb62 Mon Sep 17 00:00:00 2001 From: norareidy Date: Fri, 27 Sep 2024 13:07:39 -0400 Subject: [PATCH 11/15] upgrade guide to landing --- source/index.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/index.txt b/source/index.txt index 936dea59..81f098a8 100644 --- a/source/index.txt +++ b/source/index.txt @@ -123,12 +123,12 @@ What's New Learn about new features and changes in each version in the :ref:`` section. -.. TODO: - Upgrade {+library-short+} Versions - ---------------------------------- + +Upgrade {+library-short+} Versions +---------------------------------- - .. Learn what changes you must make to your application to upgrade driver versions - .. in the :ref:`php-upgrade` section. +Learn what changes you must make to your application to upgrade driver versions +in the :ref:`php-upgrade` section. FAQ --- From cea8e3cbb7fd3bc2a52695412fca2b6209b8ae4f Mon Sep 17 00:00:00 2001 From: norareidy Date: Fri, 27 Sep 2024 13:17:06 -0400 Subject: [PATCH 12/15] fix --- source/index.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/index.txt b/source/index.txt index 81f098a8..254d02a0 100644 --- a/source/index.txt +++ b/source/index.txt @@ -124,11 +124,11 @@ Learn about new features and changes in each version in the :ref:` Date: Fri, 27 Sep 2024 15:23:27 -0400 Subject: [PATCH 13/15] driver mentions --- snooty.toml | 1 - source/connect/stable-api.txt | 2 +- source/index.txt | 8 ++++---- source/read.txt | 2 +- source/security/authentication.txt | 2 +- source/upgrade.txt | 30 +++++++++++++++--------------- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/snooty.toml b/snooty.toml index e405fe5f..6bca29d6 100644 --- a/snooty.toml +++ b/snooty.toml @@ -39,7 +39,6 @@ php-library = "MongoDB PHP Library" [constants] php-library = "MongoDB PHP Library" -driver-short = "PHP library" extension-short = "PHP extension" mdb-server = "MongoDB Server" stable-api = "Stable API" diff --git a/source/connect/stable-api.txt b/source/connect/stable-api.txt index d65bae63..ff2b96cd 100644 --- a/source/connect/stable-api.txt +++ b/source/connect/stable-api.txt @@ -108,7 +108,7 @@ The following code example shows how you can use these parameters when construct API Documentation ----------------- -For more information about the ``MongoDB\Client`` class, see the following {+driver-short+} +For more information about the ``MongoDB\Client`` class, see the following {+library-short+} API documentation: - :phpclass:`MongoDB\Client` diff --git a/source/index.txt b/source/index.txt index 254d02a0..5627d911 100644 --- a/source/index.txt +++ b/source/index.txt @@ -124,11 +124,11 @@ Learn about new features and changes in each version in the :ref:`` page. -- Address any breaking changes between the driver version +- Address any breaking changes between the library version your application is using and your planned upgrade version in the :ref:`Breaking Changes ` section. .. tip:: To ensure compatibility across {+mdb-server+} versions when - upgrading driver versions, use the :ref:`{+stable-api+} `. + upgrading library versions, use the :ref:`{+stable-api+} `. Major and minor versions of the PHP extension and library are in sync. This means you can run an upgrade command for the extension to also upgrade the PHP @@ -75,11 +75,11 @@ Breaking Changes ---------------- A breaking change is a change of a convention or a behavior starting in a specific -version of the driver. This type of change may prevent your application from working -properly if not addressed before upgrading the driver. +version of the library. This type of change may prevent your application from working +properly if not addressed before upgrading the library. -The breaking changes in this section are categorized by the driver version that introduced -them. When upgrading driver versions, address all the breaking changes between the current +The breaking changes in this section are categorized by the library version that introduced +them. When upgrading library versions, address all the breaking changes between the current and upgrade versions. For more information on release changes, see the release notes and associated @@ -88,12 +88,12 @@ JIRA tickets for each release on `GitHub `__. From ed486c798ed9542dd7ab806bd12a4fb524242cff Mon Sep 17 00:00:00 2001 From: norareidy Date: Fri, 27 Sep 2024 16:19:42 -0400 Subject: [PATCH 14/15] RR feedback --- snooty.toml | 1 + source/connect/connection-options.txt | 2 +- source/databases-collections.txt | 4 ++-- source/includes/connect/atlas.php | 2 +- source/includes/get-started/quickstart.php | 2 +- source/includes/read/count.php | 10 +++++----- source/includes/read/retrieve.php | 6 +++--- .../includes/usage-examples/read-code-examples.php | 14 +++++++------- source/security/authentication.txt | 2 +- source/write/gridfs.txt | 2 +- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/snooty.toml b/snooty.toml index 17cb5c09..aa728e0c 100644 --- a/snooty.toml +++ b/snooty.toml @@ -43,6 +43,7 @@ extension-short = "PHP extension" mdb-server = "MongoDB Server" stable-api = "Stable API" library-short = "PHP library" +driver-short = "{+library-short+}" api = "https://www.mongodb.com/docs/php-library/current/reference" php-manual = "https://www.php.net/manual/en" string-data-type = "``string``" diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 5cbcab35..3c19fed2 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -89,7 +89,7 @@ entry in the {+mdb-server+} manual. To learn more, see the following resources: - `RFC 3986 `__ - - `rawurlencode <{+php-manual+}/rawurlencode>`__ in the PHP manual + - :php:`rawurlencode ` in the PHP manual Replica Set Options ~~~~~~~~~~~~~~~~~~~ diff --git a/source/databases-collections.txt b/source/databases-collections.txt index 0af58b59..43e2786f 100644 --- a/source/databases-collections.txt +++ b/source/databases-collections.txt @@ -66,8 +66,8 @@ the ``test_database`` database: To learn more about ``__get()`` and PHP magic methods, see the following resources: - - :phpmethod:`MongoDB\Client::__get()` in the API documentation - - `Magic Methods <{+php-manual+}/language.oop5.magic.php>`__ in the PHP manual + - :phpmethod:`MongoDB\Client::__get()` in the library API documentation + - :php:`Magic Methods ` in the PHP manual .. _php-db-coll-access-collection: diff --git a/source/includes/connect/atlas.php b/source/includes/connect/atlas.php index 36f9c5d4..43bb4ab2 100644 --- a/source/includes/connect/atlas.php +++ b/source/includes/connect/atlas.php @@ -13,6 +13,6 @@ $command = new MongoDB\Driver\Command(['ping' => 1]); $result = $admin->command($command)->toArray(); -echo json_encode($result), "\n"; +echo json_encode($result), PHP_EOL; echo 'Pinged your deployment. You successfully connected to MongoDB!\n'; diff --git a/source/includes/get-started/quickstart.php b/source/includes/get-started/quickstart.php index a5b3abb0..58237258 100644 --- a/source/includes/get-started/quickstart.php +++ b/source/includes/get-started/quickstart.php @@ -16,5 +16,5 @@ if ($result) { echo json_encode($result, JSON_PRETTY_PRINT); } else { - echo "Document not found'; + echo 'Document not found'; } diff --git a/source/includes/read/count.php b/source/includes/read/count.php index 15bf6a09..e76bbedf 100644 --- a/source/includes/read/count.php +++ b/source/includes/read/count.php @@ -13,13 +13,13 @@ // Counts all documents in the collection // start-count-all $result = $collection->countDocuments([]); -echo "Number of documents: ", $result; +echo 'Number of documents: ', $result; // end-count-all // Counts documents that have a "founded_year" value of 2010 // start-count-accurate $result = $collection->countDocuments(['founded_year' => 2010]); -echo "Number of companies founded in 2010: ", $result; +echo 'Number of companies founded in 2010: ', $result; // end-count-accurate // Counts a maximum of 100 documents that have a "number_of_employees" value of 50 @@ -28,17 +28,17 @@ ['number_of_employees' => 50], ['limit' => 100] ); -echo "Number of companies with 50 employees: ", $result; +echo 'Number of companies with 50 employees: ', $result; // end-modify-accurate // Estimates the number of documents in the collection // start-count-estimate $result = $collection->estimatedDocumentCount(); -echo "Estimated number of documents: ", $result; +echo 'Estimated number of documents: ', $result; // end-count-estimate // Estimates the number of documents in the collection and sets a time limit on the operation // start-modify-estimate $result = $collection->estimatedDocumentCount(['maxTimeMS' => 1000]); -echo "Estimated number of documents: ", $result; +echo 'Estimated number of documents: ', $result; // end-modify-estimate diff --git a/source/includes/read/retrieve.php b/source/includes/read/retrieve.php index bc4646b7..27765c96 100644 --- a/source/includes/read/retrieve.php +++ b/source/includes/read/retrieve.php @@ -11,7 +11,7 @@ // Finds one document with a "name" value of "LinkedIn" // start-find-one $document = $collection->findOne(['name' => 'LinkedIn']); -echo json_encode($document), "\n"; +echo json_encode($document), PHP_EOL; // end-find-one // Finds documents with a "founded_year" value of 1970 @@ -22,7 +22,7 @@ // Prints documents with a "founded_year" value of 1970 // start-cursor foreach ($results as $doc) { - echo json_encode($doc), "\n"; + echo json_encode($doc), PHP_EOL; } // end-cursor @@ -34,6 +34,6 @@ ); foreach ($results as $doc) { - echo json_encode($doc), "\n"; + echo json_encode($doc), PHP_EOL; } // end-modify diff --git a/source/includes/usage-examples/read-code-examples.php b/source/includes/usage-examples/read-code-examples.php index e6203cdf..d0db63b9 100644 --- a/source/includes/usage-examples/read-code-examples.php +++ b/source/includes/usage-examples/read-code-examples.php @@ -12,40 +12,40 @@ // Find One // start-find-one $document = $collection->findOne(['year' => 1994]); -echo json_encode($document) , "\n"; +echo json_encode($document), PHP_EOL; // end-find-one // Find Multiple // start-find-multiple $resultsMultiple = $collection->find(['year' => 1970]); foreach ($resultsMultiple as $doc) { - echo json_encode($doc) , "\n"; + echo json_encode($doc), PHP_EOL; } // end-find-multiple // Count Document // start-count $result = $collection->countDocuments([]); -echo "Number of documents: " . $result; +echo 'Number of documents: ', $result; // end-count // Count Specific Documents // start-count-specific $result = $collection->countDocuments(['year' => 2010]); -echo "Number of companies founded in 2010: " . $result; +echo 'Number of companies founded in 2010: ', $result; // end-count-specific // Estimated Count // start-count-estimate $result = $collection->estimatedDocumentCount(); -echo "Estimated number of documents: " . $result; +echo 'Estimated number of documents: ', $result; // end-count-estimate // Distinct Values // start-distinct $results = $collection->distinct('year'); foreach ($results as $value) { - echo json_encode($value) . PHP_EOL; + echo json_encode($value), PHP_EOL; } // end-distinct @@ -58,7 +58,7 @@ continue; } $event = $changeStream->current(); - echo toJSON($event) . PHP_EOL; + echo toJSON($event), PHP_EOL; if ($event['operationType'] === 'invalidate') { break; diff --git a/source/security/authentication.txt b/source/security/authentication.txt index 8d359cdc..e03e9856 100644 --- a/source/security/authentication.txt +++ b/source/security/authentication.txt @@ -34,7 +34,7 @@ users. To learn more, see the following resources: - `RFC 3986 `__ - - `rawurlencode <{+php-manual+}/rawurlencode>`__ in the PHP manual + - :php:`rawurlencode ` in the PHP manual .. _php-scram-sha-256: diff --git a/source/write/gridfs.txt b/source/write/gridfs.txt index 20bbc6dd..3415dc8f 100644 --- a/source/write/gridfs.txt +++ b/source/write/gridfs.txt @@ -58,7 +58,7 @@ chunks, each represented by a separate document in the ``chunks`` collection. It also creates a document in the ``files`` collection that contains a file ID, file name, and other file metadata. You can upload the file by passing a stream to the {+php-library+} to consume or creating a new stream and writing to it -directly. To learn more about streams, see `Streams <{+php-manual+}/book.stream.php>`__ +directly. To learn more about streams, see :php:`Streams ` in the PHP manual. View the following diagram to see how GridFS splits the files when uploaded to From b7643649d1b71efe9f9a99ed618a5a6a40534597 Mon Sep 17 00:00:00 2001 From: norareidy Date: Fri, 27 Sep 2024 16:25:05 -0400 Subject: [PATCH 15/15] build fix --- source/tutorial/commands.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/tutorial/commands.txt b/source/tutorial/commands.txt index ff0de205..83dc6270 100644 --- a/source/tutorial/commands.txt +++ b/source/tutorial/commands.txt @@ -103,7 +103,7 @@ Specifying a Custom Read Preference ----------------------------------- Write commands, such as :manual:`createUser `, -can only be executed on a writable server (e.g. :term:`primary` replica set +can only be executed on a writable server (e.g. primary replica set member). Command helper methods in the |php-library|, such as :phpmethod:`MongoDB\Database::drop()`, know to apply their own :term:`read preference` if necessary. However, the :phpmethod:`MongoDB\Database::command()`