From 45739f4a600e8e9332b9deedf0a52c5e455a00c4 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:31:53 -0500 Subject: [PATCH 01/36] wip --- snooty.toml | 3 + source/connect/connection-options.txt | 346 ++++++++++++++++++ source/connect/py-connect.txt | 265 ++++++++++++++ .../includes/connect/connection-options.php | 42 +++ source/reference/class/MongoDBClient.txt | 2 + 5 files changed, 658 insertions(+) create mode 100644 source/connect/connection-options.txt create mode 100644 source/connect/py-connect.txt create mode 100644 source/includes/connect/connection-options.php diff --git a/snooty.toml b/snooty.toml index 507f09d6..ed288374 100644 --- a/snooty.toml +++ b/snooty.toml @@ -25,3 +25,6 @@ php-library = "MongoDB PHP Library" [constants] php-library = "MongoDB PHP Library" api = "https://www.mongodb.com/docs/php-library/current/reference" +string-data-type = "``string``" +bool-data-type = "``bool``" +int-data-type = "``int``" diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt new file mode 100644 index 00000000..fe7d12bc --- /dev/null +++ b/source/connect/connection-options.txt @@ -0,0 +1,346 @@ +.. _php-connection-options: + +========================== +Specify Connection Options +========================== + +.. contents:: On this page + :local: + :backlinks: none + :depth: 2 + :class: singlecol + +.. facet:: + :name: genre + :values: reference + +.. meta:: + :keywords: connection string, URI, server, Atlas, settings, configure + +Overview +-------- + +This page describes the MongoDB connection and authentication options +available in the {+driver-short+}. + +Set Connection Options +---------------------- + +You can configure your connection by specifying options in the connection URI or by +passing them to the ``MongoDB\Client`` constructor. + +.. TODO: +how uri object overrides uri +- finish intro text + +.. _php-connection-uri: + +Using the Connection URI +~~~~~~~~~~~~~~~~~~~~~~~~ + +If you pass a connection URI to the ``MongoDB\Client`` constructor, you can include +connection options in the URI as ``=`` pairs. In the following example, +the connection URI contains the ``tls`` option with a value of ``true`` and the +``tlsCertificateKeyFile`` option with a value of ``/path/to/file.pem``: + +.. literalinclude:: /includes/connect/connection-options.php + :language: php + :copyable: true + :start-after: // start-connection-uri + :end-before: // end-connection-uri + :emphasize-lines: 8 + +.. _php-client-object: + +Using a MongoDB\Client Object +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can pass connection options to the ``MongoDB\Client`` constructor +instead of including them in your connection URI. +Configuring the connection this way makes it easier to +change settings at runtime and helps you catch errors during compilation. + +The following example shows how to use the the ``$uriOptions`` parameter of the +``MongoDB\Client`` constructor to set connection options: + +.. literalinclude:: /includes/connect/connection-options.php + :language: php + :copyable: true + :start-after: // start-client-options + :end-before: // end-client-options + :emphasize-lines: 8-12, 15 + +Connection URI Options +---------------------- + +The following sections describe the options that you can set for your connection to +MongoDB. Each connection option links to its corresponding +entry in the {+mdb-server+} manual. + +Replica Set Options +~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`directConnection ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'directConnection' => true ];`` + | **Connection URI**: ``directConnection=true`` + + * - :manual:`replicaSet ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` + | **Connection URI**: ``replicaSet=replicaSetName`` + +Connection Options +~~~~~~~~~~~~~~~~~~ + +TLS Options +``````````` +To learn about the TLS options available in the {+driver-short+}, see the +:ref:`TLS ` page. + +Timeout Options +``````````````` + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`connectTimeoutMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` + | **Connection URI**: ``connectTimeoutMS=20000`` + + * - :manual:`socketTimeoutMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` + | **Connection URI**: ``socketTimeoutMS=400000`` + +.. _php-compression-options: + +Compression Options +``````````````````` + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`compressors ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` + | **Connection URI**: ``compressors=snappy,zstd,zlib`` + + * - :manual:`zlibCompressionLevel ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib', 'zlibCompressionLevel' => 3 ];`` + | **Connection URI**: ``compressors=snappy,zstd,zlib&zlibCompressionLevel=3`` + +Connection Pool Options +~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`maxPoolSize ` + - {+int-data-type+} + - | **Connection URI**: ``maxPoolSize=75`` + + * - :manual:`waitQueueTimeoutMS ` + - {+int-data-type+} + - | **Connection URI**: ``waitQueueTimeoutMS=10000`` + +Write Concern Options +~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`w ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'w' => 'majority' ];`` + | **Connection URI**: ``w=majority`` + + * - :manual:`wTimeoutMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` + | **Connection URI**: ``wTimeoutMS=10000`` + + * - :manual:`journal ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'journal' => true ];`` + | **Connection URI**: ``journal=true`` + +Read Concern Options +~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`readConcernLevel ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` + | **Connection URI**: ``readConcernLevel=majority`` + +Read Preference Options +~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`readPreference ` + - `MongoDB\Driver\ReadPreference `__ + - | **MongoDB\Client**: ``$uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ];`` + | **Connection URI**: ``readPreference=secondaryPreferred`` + + * - :manual:`maxStalenessSeconds ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` + | **Connection URI**: ``maxStalenessSeconds=30`` + + * - :manual:`readPreferenceTags ` + - ``array`` + - | **MongoDB\Client**: ``$uriOptions = [ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']];`` + | **Connection URI**: ``readPreferenceTags=region:east,region:west`` + + +Authentication Options +~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`authMechanism ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` + | **Connection URI**: ``authMechanism=MONGODB-X509`` + + * - :manual:`authMechanismProperties ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` + | **Connection URI**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` + + * - :manual:`authSource ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'authSource' => 'admin' ];`` + | **Connection URI**: ``authSource=admin`` + +Server Selection and Discovery Options +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`localThresholdMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` + | **Connection URI**: ``localThresholdMS=20`` + + * - :manual:`serverSelectionTimeoutMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` + | **Connection URI**: ``serverSelectionTimeoutMS=40000`` + + * - :manual:`serverSelectionTryOnce ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` + | **Connection URI**: ``serverSelectionTryOnce=false`` + + * - :manual:`heartbeatFrequencyMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` + | **Connection URI**: ``heartbeatFrequencyMS=50000`` + + * - :manual:`socketCheckIntervalMS ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` + | **Connection URI**: ``socketCheckIntervalMS=4000`` + +Miscellaneous Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :stub-columns: 1 + + * - Connection Option + - Data Type + - Syntax + + * - :manual:`appName ` + - {+string-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'appName' => 'myApp' ];`` + | **Connection URI**: ``appName=myApp`` + + * - :manual:`retryReads ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'retryReads' => false ];`` + | **Connection URI**: ``retryReads=false`` + + * - :manual:`retryWrites ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'retryWrites' => false ];`` + | **Connection URI**: ``retryWrites=false`` + + * - :manual:`loadBalanced ` + - {+bool-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'loadBalanced' => true ];`` + | **Connection URI**: ``loadBalanced=false`` + + * - :manual:`srvMaxHosts ` + - {+int-data-type+} + - | **MongoDB\Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` + | **Connection URI**: ``srvMaxHosts=5`` + +API Documentation +----------------- + +For more information about the types used on this page, see the following API +documentation: + +- :ref:`MongoDB\Client ` +- `MongoDB\Driver\ReadPreference `__ \ No newline at end of file diff --git a/source/connect/py-connect.txt b/source/connect/py-connect.txt new file mode 100644 index 00000000..2c6637e1 --- /dev/null +++ b/source/connect/py-connect.txt @@ -0,0 +1,265 @@ +.. _pymongo-connection-options: + +========================== +Specify Connection Options +========================== + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. facet:: + :name: genre + :values: reference + +.. meta:: + :keywords: connection string, URI, server, Atlas, settings, configure + +Overview +-------- + +This section describes the MongoDB connection and authentication options +available in {+driver-short+}. You can configure your connection using either +the connection URI or arguments to the ``MongoClient`` constructor. + +.. _pymongo-connection-uri: + +Using the Connection URI +~~~~~~~~~~~~~~~~~~~~~~~~ + +If you pass a connection URI to the ``MongoClient`` constructor, you can include +connection options in the string as ``=`` pairs. In the following example, +the connection URI contains the ``connectTimeoutMS`` option with a value of ``60000`` +and the ``tls`` option with a value of ``true``: + +.. code-block:: python + + uri = "mongodb://:/?connectTimeoutMS=60000&tls=true" + client = pymongo.MongoClient(uri) + +.. _pymongo-mongo-client-settings: + +Using a ``MongoClient`` +~~~~~~~~~~~~~~~~~~~~~~~ + +You can pass connection options as arguments to the ``MongoClient`` constructor +instead of including them in your connection URI. +Configuring the connection this way makes it easier to +change settings at runtime and helps you catch errors during compilation. +The following example shows how to use the ``MongoClient`` constructor to set +connection options: + +.. code-block:: python + + uri = "mongodb://:" + client = pymongo.MongoClient(uri, connectTimeoutMS=60000, tls=True) + +Connection Options +------------------ + +The following sections describe the connection options available in {+driver-short+}. +If a ``MongoClient`` parameter maps to more than one +option in the connection string, the **Connection URI Example** shows all +relevant options. + +.. todo: .. note:: + If you're using a query parameter for a time duration, the value must be in + milliseconds. For example, to specify 60 seconds, use the value ``60000``. If you're + using a ``MongoClientSettings`` object for a time duration, use the appropriate + ``TimeSpan`` value. + +Network Compression +~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :widths: 30 70 + + * - Connection Option + - Description + + * - **compressors** + - | The preferred compression types, in order, for wire-protocol messages sent to + | or received from the server. The driver uses the first of these compression types + | that the server supports. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``None`` + | **MongoClient Example**: ``compressors = "snappy,zstd,zlib"`` + | **Connection URI Example**: ``compressors=snappy,zstd,zlib`` + + * - **zlibCompressionLevel** + - | The compression level for zlib to use. This option accepts + | an integer value between ``-1`` and ``9``: + | + | - **-1:** (Default). zlib uses its default compression level (usually ``6``). + | - **0:** No compression. + | - **1:** Fastest speed but lowest compression. + | - **9:** Best compression but slowest speed. + | + | **Data Type**: {+int-data-type+} + | **Default**: ``-1`` + | **MongoClient Example**: ``zlibCompressionLevel = 3`` + | **Connection URI Example**: ``zlibCompressionLevel=3`` + +Timeouts +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :widths: 30 70 + + * - Connection Option + - Description + + * - **timeoutMS** + - | The number of milliseconds each driver operation must complete within. If an + | operation doesn't finish in the specified time, {+driver-short+} raises a timeout exception. + | For more information, see :ref:``. + | + | **Data Type**: ``int`` + | **Default**: ``None`` + | **MongoClient Example**: ``timeoutMS = 10000`` + | **Connection URI Example**: ``timeoutMs=10000`` + +Server Selection +~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :widths: 30 70 + + * - Connection Option + - Description + + * - **server_selector** + - | A user-defined Python function called by {+driver-short+} to choose the server + | to run an operation against. For more information, see + | :ref:``. + | + | **Data Type**: ``callable`` + | **Default**: ``None`` + | **MongoClient Example**: ``server_selector = your_function`` + | **Connection URI Example**: N/A + +Authentication +~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :widths: 30 70 + + * - Connection Option + - Description + + * - **authMechanism** + - | The mechanism {+driver-short+} uses to authenticate the application. Valid + | options are defined in `MECHANISMS. <{+api-root+}pymongo/database.html#pymongo.auth.MECHANISMS>`__ + | + | **Data Type**: {+string-data-type+} + | **Default**: ``"SCRAM-SHA-256"`` when connecting to MongoDB v4.0 or later. + | ``"SCRAM-SHA-1"`` when connecting to MongoDB v3.0 through v3.13. + | **MongoClient Example**: ``authMechanism = "MONGODB-X509"`` + | **Connection URI Example**: ``authMechanism=MONGODB-X509`` + + * - **authMechanismProperties** + - | Options specific to the authentication mechanism. Not needed for all authentication + | mechanisms. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``""`` + | **MongoClient Example**: ``authMechanismProperties = "AWS_SESSION_TOKEN:12345"`` + | **Connection URI Example**: ``authMechanismProperties=AWS_SESSION_TOKEN:12435`` + + * - **authSource** + - | The database to authenticate against. + | + | **Data Type**: {+string-data-type+} + | **Default**: The database in the connection URI, or ``"admin"`` if none is provided + | **MongoClient Example**: ``authSource = "admin"`` + | **Connection URI Example**: ``authSource=admin`` + + * - **username** + - | The username for authentication. When this option is included in a connection + | URI, you must percent-escape it. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``""`` + | **MongoClient Example**: ``username = "my user"`` + | **Connection URI Example**: ``username=my+user`` + + * - **password** + - | The password for authentication. When this option is included in a connection + | URI, you must percent-escape it. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``""`` + | **MongoClient Example**: ``password = "strong password"`` + | **Connection URI Example**: ``password=strong+password`` + +For more information about the connection option in this section, see :ref:`pymongo-auth`. + +Read and Write Operations +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + :widths: 30 70 + + * - Connection Option + - Description + + * - **replicaSet** + - | Specifies the name of the replica set to connect to. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``null`` + | **MongoClient Example**: ``replicaSet='replicaSetName'`` + | **Connection URI Example**: ``replicaSet=replicaSetName`` + + * - **directConnection** + - | Whether to connect only to the primary member of the replica set. + | + | **Data Type**: {+bool-data-type+} + | **Default**: ``False`` + | **MongoClient Example**: ``directConnection=True`` + | **Connection URI Example**: ``directConnection=true`` + + * - **readPreference** + - | Specifies the client's read-preference settings. + | + | **Data Type**: `read_preferences <{+api-root+}pymongo/read_preferences.html#pymongo.read_preferences>`__ + | **Default**: ``ReadPreference.Primary`` + | **MongoClient Example**: ``readPreference=ReadPreference.SECONDARY_PREFERRED`` + | **Connection URI Example**: ``readPreference=secondaryPreferred`` + + * - **readConcern** + - | Specifies the client's read-concern settings. For more information, see :manual:``. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``None`` + | **MongoClient Example**: ``readConcern="majority"`` + | **Connection URI Example**: ``readConcern=majority`` + + * - **writeConcern** + - | Specifies the client's write-concern settings. For more information, see + :manual:``. + | + | **Data Type**: {+string-data-type+} + | **Default**: ``None`` + | **MongoClient Example**: ``writeConcern="majority"`` + | **Connection URI Example**: ``writeConcern=majority`` + + * - **localThresholdMS** + - | The latency window for a replica-set members eligibility. If a member's + round trip ping takes longer than the fastest server's round-trip ping + time plus this value, the server isn't eligible for selection. + | + | **Data Type**: `read_preferences <{+api-root+}pymongo/read_preferences.html#pymongo.read_preferences>`__ + | **Default**: ``{+int-data-type+}`` + | **MongoClient Example**: ``localThresholdMS=35`` + | **Connection URI Example**: ``localThresholdMS=35`` + +For more information about the connection option in this section, see :ref:`pymongo-databases-collections`. diff --git a/source/includes/connect/connection-options.php b/source/includes/connect/connection-options.php new file mode 100644 index 00000000..b5645459 --- /dev/null +++ b/source/includes/connect/connection-options.php @@ -0,0 +1,42 @@ +// start-connection-uri +:/?tls=true&tlsCertificateKeyFile=path/to/file.pem"; + +// Create a MongoDB client +$client = new MongoDB\Client($uri); +// end-connection-uri + +// start-client-options +#include +#include +#include + +int main() +{ + mongocxx::instance instance; + mongocxx::options::client client_options; + mongocxx::options::tls tls_options; + + tls_options.pem_file("/path/to/file.pem"); + client_options.tls_opts(tls_options); + + mongocxx::uri uri("mongodb://:/?tls=true"); + mongocxx::client client(uri, client_options); +} +// end-client-options + +// start-uri-object +#include +#include +#include + +int main() +{ + mongocxx::instance instance; + mongocxx::uri uri("mongodb://:/?tls=true"); + mongocxx::client client(uri); + auto is_tls_enabled = uri.tls(); +} +// end-uri-object \ No newline at end of file diff --git a/source/reference/class/MongoDBClient.txt b/source/reference/class/MongoDBClient.txt index d5145c65..96a633ae 100644 --- a/source/reference/class/MongoDBClient.txt +++ b/source/reference/class/MongoDBClient.txt @@ -1,3 +1,5 @@ +.. _php-mongodbclient: + ===================== MongoDB\\Client Class ===================== From 1df7cf08c4ed168512b8c9bb9a9121c043274ef1 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:15:27 -0500 Subject: [PATCH 02/36] formatting --- snooty.toml | 1 + source/connect/connection-options.txt | 28 +++++++++++++------ .../includes/connect/connection-options.php | 25 ++++++++--------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/snooty.toml b/snooty.toml index ed288374..d1f398fd 100644 --- a/snooty.toml +++ b/snooty.toml @@ -25,6 +25,7 @@ php-library = "MongoDB PHP Library" [constants] php-library = "MongoDB PHP Library" api = "https://www.mongodb.com/docs/php-library/current/reference" +driver-short = "PHP library" string-data-type = "``string``" bool-data-type = "``bool``" int-data-type = "``int``" diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index fe7d12bc..afc537c4 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -30,8 +30,8 @@ You can configure your connection by specifying options in the connection URI or passing them to the ``MongoDB\Client`` constructor. .. TODO: -how uri object overrides uri -- finish intro text +-code samples +- fix table widths .. _php-connection-uri: @@ -52,8 +52,8 @@ the connection URI contains the ``tls`` option with a value of ``true`` and the .. _php-client-object: -Using a MongoDB\Client Object -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Using a MongoDB\\Client Object +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can pass connection options to the ``MongoDB\Client`` constructor instead of including them in your connection URI. @@ -70,6 +70,11 @@ The following example shows how to use the the ``$uriOptions`` parameter of the :end-before: // end-client-options :emphasize-lines: 8-12, 15 +.. note:: + + If you specify an option in both the ``MongoDB\Client`` object and in the connection + URI, the value in the ``MongoDB\Client`` object takes precedence. + Connection URI Options ---------------------- @@ -135,6 +140,7 @@ Compression Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 20 10 70 * - Connection Option - Data Type @@ -148,6 +154,7 @@ Compression Options * - :manual:`zlibCompressionLevel ` - {+int-data-type+} - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib', 'zlibCompressionLevel' => 3 ];`` + | | **Connection URI**: ``compressors=snappy,zstd,zlib&zlibCompressionLevel=3`` Connection Pool Options @@ -163,11 +170,13 @@ Connection Pool Options * - :manual:`maxPoolSize ` - {+int-data-type+} - - | **Connection URI**: ``maxPoolSize=75`` + - | **MongoDB\Client**: N/A + | **Connection URI**: ``maxPoolSize=75`` * - :manual:`waitQueueTimeoutMS ` - {+int-data-type+} - - | **Connection URI**: ``waitQueueTimeoutMS=10000`` + - | **MongoDB\Client**: N/A + | **Connection URI**: ``waitQueueTimeoutMS=10000`` Write Concern Options ~~~~~~~~~~~~~~~~~~~~~ @@ -217,13 +226,14 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 20 20 60 * - Connection Option - Data Type - Syntax * - :manual:`readPreference ` - - `MongoDB\Driver\ReadPreference `__ + - `MongoDB\\Driver\\ReadPreference `__ - | **MongoDB\Client**: ``$uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ];`` | **Connection URI**: ``readPreference=secondaryPreferred`` @@ -237,13 +247,13 @@ Read Preference Options - | **MongoDB\Client**: ``$uriOptions = [ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']];`` | **Connection URI**: ``readPreferenceTags=region:east,region:west`` - Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 20 10 70 * - Connection Option - Data Type @@ -343,4 +353,4 @@ For more information about the types used on this page, see the following API documentation: - :ref:`MongoDB\Client ` -- `MongoDB\Driver\ReadPreference `__ \ No newline at end of file +- `MongoDB\\Driver\\ReadPreference `__ \ No newline at end of file diff --git a/source/includes/connect/connection-options.php b/source/includes/connect/connection-options.php index b5645459..57d42a7a 100644 --- a/source/includes/connect/connection-options.php +++ b/source/includes/connect/connection-options.php @@ -2,29 +2,26 @@ :/?tls=true&tlsCertificateKeyFile=path/to/file.pem"; +$uri = "mongodb://:/?tls=true&tlsCertificateKeyFile=/path/to/file.pem"; // Create a MongoDB client $client = new MongoDB\Client($uri); // end-connection-uri // start-client-options -#include -#include -#include +:/"; - tls_options.pem_file("/path/to/file.pem"); - client_options.tls_opts(tls_options); +// Set the connection options +$uriOptions = [ + 'tls' => true, + 'tlsCertificateKeyFile' => '/path/to/file.pem' +]; - mongocxx::uri uri("mongodb://:/?tls=true"); - mongocxx::client client(uri, client_options); -} +// Create a MongoDB client with the URI and options +$client = new Client($uri, $uriOptions); // end-client-options // start-uri-object From 7d07a4d20ad3a9c153105a2d11ee26d5573756a2 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:32:44 -0500 Subject: [PATCH 03/36] format --- source/connect/connection-options.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index afc537c4..85259100 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -68,7 +68,7 @@ The following example shows how to use the the ``$uriOptions`` parameter of the :copyable: true :start-after: // start-client-options :end-before: // end-client-options - :emphasize-lines: 8-12, 15 + :emphasize-lines: 7-10, 13 .. note:: @@ -140,7 +140,7 @@ Compression Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 20 10 70 + :widths: 30 10 60 * - Connection Option - Data Type @@ -226,7 +226,7 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 20 20 60 + :widths: 25 25 50 * - Connection Option - Data Type @@ -253,7 +253,7 @@ Authentication Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 20 10 70 + :widths: 30 10 60 * - Connection Option - Data Type @@ -280,6 +280,7 @@ Server Selection and Discovery Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 35 10 55 * - Connection Option - Data Type From d505ef189751b614a6cc6f090a7c3548a2b48bf8 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:34:57 -0500 Subject: [PATCH 04/36] test --- source/connect/connection-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 85259100..21bae670 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -140,7 +140,7 @@ Compression Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 30 10 60 + :widths: 45 10 45 * - Connection Option - Data Type From 5fcd405d2deaaf9e68930d5566afea56f454064f Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:36:56 -0500 Subject: [PATCH 05/36] test --- source/connect/connection-options.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 21bae670..1954693c 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -153,8 +153,7 @@ Compression Options * - :manual:`zlibCompressionLevel ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib', 'zlibCompressionLevel' => 3 ];`` - | + - | **MongoDB\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` | **Connection URI**: ``compressors=snappy,zstd,zlib&zlibCompressionLevel=3`` Connection Pool Options From aa3a2f3b34300b23a805abffdd1ce2fc34747280 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:38:18 -0500 Subject: [PATCH 06/36] test --- source/connect/connection-options.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 1954693c..0c89674b 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -140,7 +140,6 @@ Compression Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 45 10 45 * - Connection Option - Data Type From d7e522775a33cb0ca46e2a8a1cb08c47c1d6fe51 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:46:54 -0500 Subject: [PATCH 07/36] test --- source/connect/connection-options.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 0c89674b..660068ea 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -153,7 +153,7 @@ Compression Options * - :manual:`zlibCompressionLevel ` - {+int-data-type+} - | **MongoDB\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` - | **Connection URI**: ``compressors=snappy,zstd,zlib&zlibCompressionLevel=3`` + | **Connection URI**: ``zlibCompressionLevel=3`` Connection Pool Options ~~~~~~~~~~~~~~~~~~~~~~~ @@ -232,7 +232,8 @@ Read Preference Options * - :manual:`readPreference ` - `MongoDB\\Driver\\ReadPreference `__ - - | **MongoDB\Client**: ``$uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ];`` + - | **MongoDB\Client**: + | ``$uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ];`` | **Connection URI**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` From 0dbe1e671ce0e32a89e9b5b8da4c871dbaf66ef2 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:48:35 -0500 Subject: [PATCH 08/36] test --- source/connect/connection-options.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 660068ea..7a99457f 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -233,7 +233,10 @@ Read Preference Options * - :manual:`readPreference ` - `MongoDB\\Driver\\ReadPreference `__ - | **MongoDB\Client**: - | ``$uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ];`` + | .. code-block:: + | + | $uriOptions = [ 'readPreference' => + | MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ]; | **Connection URI**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` From 916ed85438442354000d2d8a517dddec43ea1d55 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:58:35 -0500 Subject: [PATCH 09/36] test --- source/connect/connection-options.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 7a99457f..e7bcfb76 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -232,12 +232,13 @@ Read Preference Options * - :manual:`readPreference ` - `MongoDB\\Driver\\ReadPreference `__ - - | **MongoDB\Client**: - | .. code-block:: - | - | $uriOptions = [ 'readPreference' => - | MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ]; - | **Connection URI**: ``readPreference=secondaryPreferred`` + - **MongoDB\Client**: + + .. code-block:: + + $uriOptions = [ 'readPreference' => + MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ]; + **Connection URI**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` - {+int-data-type+} From 73dc918f375eeef5b2985412fb6fdd0ed90c5d37 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:59:22 -0500 Subject: [PATCH 10/36] test --- source/connect/connection-options.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index e7bcfb76..251c86b1 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -238,7 +238,8 @@ Read Preference Options $uriOptions = [ 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ]; - **Connection URI**: ``readPreference=secondaryPreferred`` + + **Connection URI**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` - {+int-data-type+} From 9767bfd5eea72596e5dfb89cf11704dd64f81286 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:01:16 -0500 Subject: [PATCH 11/36] test --- source/connect/connection-options.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 251c86b1..80b811b8 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -224,7 +224,6 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 25 25 50 * - Connection Option - Data Type @@ -236,8 +235,9 @@ Read Preference Options .. code-block:: - $uriOptions = [ 'readPreference' => - MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED ]; + $uriOptions = [ + 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED + ]; **Connection URI**: ``readPreference=secondaryPreferred`` From bf43a6cfcc90335490860018ea7848ec994f2648 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:08:28 -0500 Subject: [PATCH 12/36] test --- source/connect/connection-options.txt | 77 ++++++++++++++------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 80b811b8..46bc233b 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -95,12 +95,12 @@ Replica Set Options * - :manual:`directConnection ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'directConnection' => true ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'directConnection' => true ];`` | **Connection URI**: ``directConnection=true`` * - :manual:`replicaSet ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` | **Connection URI**: ``replicaSet=replicaSetName`` Connection Options @@ -124,12 +124,12 @@ Timeout Options * - :manual:`connectTimeoutMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` | **Connection URI**: ``connectTimeoutMS=20000`` * - :manual:`socketTimeoutMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` | **Connection URI**: ``socketTimeoutMS=400000`` .. _php-compression-options: @@ -147,12 +147,12 @@ Compression Options * - :manual:`compressors ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` | **Connection URI**: ``compressors=snappy,zstd,zlib`` * - :manual:`zlibCompressionLevel ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` | **Connection URI**: ``zlibCompressionLevel=3`` Connection Pool Options @@ -168,12 +168,12 @@ Connection Pool Options * - :manual:`maxPoolSize ` - {+int-data-type+} - - | **MongoDB\Client**: N/A + - | **MongoDB\\Client**: N/A | **Connection URI**: ``maxPoolSize=75`` * - :manual:`waitQueueTimeoutMS ` - {+int-data-type+} - - | **MongoDB\Client**: N/A + - | **MongoDB\\Client**: N/A | **Connection URI**: ``waitQueueTimeoutMS=10000`` Write Concern Options @@ -189,17 +189,17 @@ Write Concern Options * - :manual:`w ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'w' => 'majority' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'w' => 'majority' ];`` | **Connection URI**: ``w=majority`` * - :manual:`wTimeoutMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` | **Connection URI**: ``wTimeoutMS=10000`` * - :manual:`journal ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'journal' => true ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'journal' => true ];`` | **Connection URI**: ``journal=true`` Read Concern Options @@ -215,7 +215,7 @@ Read Concern Options * - :manual:`readConcernLevel ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` | **Connection URI**: ``readConcernLevel=majority`` Read Preference Options @@ -230,26 +230,31 @@ Read Preference Options - Syntax * - :manual:`readPreference ` - - `MongoDB\\Driver\\ReadPreference `__ - - **MongoDB\Client**: - - .. code-block:: - - $uriOptions = [ - 'readPreference' => MongoDB\Driver\ReadPreference.RP_SECONDARY_PREFERRED - ]; + - ``int`` or ``string`` + - **MongoDB\\Client**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` **Connection URI**: ``readPreference=secondaryPreferred`` + + For a complete list of the available values for this option, see the + `MongoDB\\Driver\\ReadPreference `__ + API documentation. * - :manual:`maxStalenessSeconds ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` | **Connection URI**: ``maxStalenessSeconds=30`` * - :manual:`readPreferenceTags ` - ``array`` - - | **MongoDB\Client**: ``$uriOptions = [ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']];`` - | **Connection URI**: ``readPreferenceTags=region:east,region:west`` + - **MongoDB\\Client**: + + .. code-block:: + + $uriOptions = [ + 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']] + ]; + + **Connection URI**: ``readPreferenceTags=region:east,region:west`` Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ @@ -265,17 +270,17 @@ Authentication Options * - :manual:`authMechanism ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` | **Connection URI**: ``authMechanism=MONGODB-X509`` * - :manual:`authMechanismProperties ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` | **Connection URI**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` * - :manual:`authSource ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'authSource' => 'admin' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'authSource' => 'admin' ];`` | **Connection URI**: ``authSource=admin`` Server Selection and Discovery Options @@ -292,27 +297,27 @@ Server Selection and Discovery Options * - :manual:`localThresholdMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` | **Connection URI**: ``localThresholdMS=20`` * - :manual:`serverSelectionTimeoutMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` | **Connection URI**: ``serverSelectionTimeoutMS=40000`` * - :manual:`serverSelectionTryOnce ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` | **Connection URI**: ``serverSelectionTryOnce=false`` * - :manual:`heartbeatFrequencyMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` | **Connection URI**: ``heartbeatFrequencyMS=50000`` * - :manual:`socketCheckIntervalMS ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` | **Connection URI**: ``socketCheckIntervalMS=4000`` Miscellaneous Configuration @@ -328,27 +333,27 @@ Miscellaneous Configuration * - :manual:`appName ` - {+string-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'appName' => 'myApp' ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'appName' => 'myApp' ];`` | **Connection URI**: ``appName=myApp`` * - :manual:`retryReads ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'retryReads' => false ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'retryReads' => false ];`` | **Connection URI**: ``retryReads=false`` * - :manual:`retryWrites ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'retryWrites' => false ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'retryWrites' => false ];`` | **Connection URI**: ``retryWrites=false`` * - :manual:`loadBalanced ` - {+bool-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'loadBalanced' => true ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'loadBalanced' => true ];`` | **Connection URI**: ``loadBalanced=false`` * - :manual:`srvMaxHosts ` - {+int-data-type+} - - | **MongoDB\Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` + - | **MongoDB\\Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` | **Connection URI**: ``srvMaxHosts=5`` API Documentation From 6bfb36740a7452a39f7253f0c905cd47b376f7d3 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:11:01 -0500 Subject: [PATCH 13/36] test --- source/connect/connection-options.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 46bc233b..fa458ca8 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -224,6 +224,7 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :width: 20 20 60 * - Connection Option - Data Type @@ -249,6 +250,7 @@ Read Preference Options - **MongoDB\\Client**: .. code-block:: + :copyable: false $uriOptions = [ 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']] From 3a4ead0b5c45393a5028baf131ea873fbecfe169 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:13:07 -0500 Subject: [PATCH 14/36] test --- source/connect/connection-options.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index fa458ca8..ad5df96e 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -253,7 +253,10 @@ Read Preference Options :copyable: false $uriOptions = [ - 'readPreferenceTags' => [[ 'region' => 'east' ], [ 'region' => 'west']] + 'readPreferenceTags' => [ + [ 'region' => 'east' ], + [ 'region' => 'west'] + ] ]; **Connection URI**: ``readPreferenceTags=region:east,region:west`` From d68b868c1478d8d5167cb31e6fbd5a0a83c15c1c Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:24:58 -0500 Subject: [PATCH 15/36] test --- source/connect/connection-options.txt | 119 +++++++++++++------------- 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index ad5df96e..d4256a5e 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -31,7 +31,7 @@ passing them to the ``MongoDB\Client`` constructor. .. TODO: -code samples -- fix table widths +- move information to right colummn of tables .. _php-connection-uri: @@ -90,18 +90,17 @@ Replica Set Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`directConnection ` - - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'directConnection' => true ];`` - | **Connection URI**: ``directConnection=true`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'directConnection' => true ];`` + | **Connection URI Example**: ``directConnection=true`` * - :manual:`replicaSet ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` - | **Connection URI**: ``replicaSet=replicaSetName`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` + | **Connection URI Example**: ``replicaSet=replicaSetName`` Connection Options ~~~~~~~~~~~~~~~~~~ @@ -124,13 +123,13 @@ Timeout Options * - :manual:`connectTimeoutMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` - | **Connection URI**: ``connectTimeoutMS=20000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` + | **Connection URI Example**: ``connectTimeoutMS=20000`` * - :manual:`socketTimeoutMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` - | **Connection URI**: ``socketTimeoutMS=400000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` + | **Connection URI Example**: ``socketTimeoutMS=400000`` .. _php-compression-options: @@ -147,13 +146,13 @@ Compression Options * - :manual:`compressors ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` - | **Connection URI**: ``compressors=snappy,zstd,zlib`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` + | **Connection URI Example**: ``compressors=snappy,zstd,zlib`` * - :manual:`zlibCompressionLevel ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` - | **Connection URI**: ``zlibCompressionLevel=3`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` + | **Connection URI Example**: ``zlibCompressionLevel=3`` Connection Pool Options ~~~~~~~~~~~~~~~~~~~~~~~ @@ -168,13 +167,13 @@ Connection Pool Options * - :manual:`maxPoolSize ` - {+int-data-type+} - - | **MongoDB\\Client**: N/A - | **Connection URI**: ``maxPoolSize=75`` + - | **MongoDB\\Client Example**: N/A + | **Connection URI Example**: ``maxPoolSize=75`` * - :manual:`waitQueueTimeoutMS ` - {+int-data-type+} - - | **MongoDB\\Client**: N/A - | **Connection URI**: ``waitQueueTimeoutMS=10000`` + - | **MongoDB\\Client Example**: N/A + | **Connection URI Example**: ``waitQueueTimeoutMS=10000`` Write Concern Options ~~~~~~~~~~~~~~~~~~~~~ @@ -189,18 +188,18 @@ Write Concern Options * - :manual:`w ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'w' => 'majority' ];`` - | **Connection URI**: ``w=majority`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'w' => 'majority' ];`` + | **Connection URI Example**: ``w=majority`` * - :manual:`wTimeoutMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` - | **Connection URI**: ``wTimeoutMS=10000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` + | **Connection URI Example**: ``wTimeoutMS=10000`` * - :manual:`journal ` - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'journal' => true ];`` - | **Connection URI**: ``journal=true`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'journal' => true ];`` + | **Connection URI Example**: ``journal=true`` Read Concern Options ~~~~~~~~~~~~~~~~~~~~ @@ -215,8 +214,8 @@ Read Concern Options * - :manual:`readConcernLevel ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` - | **Connection URI**: ``readConcernLevel=majority`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` + | **Connection URI Example**: ``readConcernLevel=majority`` Read Preference Options ~~~~~~~~~~~~~~~~~~~~~~~ @@ -232,9 +231,9 @@ Read Preference Options * - :manual:`readPreference ` - ``int`` or ``string`` - - **MongoDB\\Client**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` + - **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` - **Connection URI**: ``readPreference=secondaryPreferred`` + **Connection URI Example**: ``readPreference=secondaryPreferred`` For a complete list of the available values for this option, see the `MongoDB\\Driver\\ReadPreference `__ @@ -242,12 +241,12 @@ Read Preference Options * - :manual:`maxStalenessSeconds ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` - | **Connection URI**: ``maxStalenessSeconds=30`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` + | **Connection URI Example**: ``maxStalenessSeconds=30`` * - :manual:`readPreferenceTags ` - ``array`` - - **MongoDB\\Client**: + - **MongoDB\\Client Example**: .. code-block:: :copyable: false @@ -259,7 +258,7 @@ Read Preference Options ] ]; - **Connection URI**: ``readPreferenceTags=region:east,region:west`` + **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ @@ -275,18 +274,18 @@ Authentication Options * - :manual:`authMechanism ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` - | **Connection URI**: ``authMechanism=MONGODB-X509`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` + | **Connection URI Example**: ``authMechanism=MONGODB-X509`` * - :manual:`authMechanismProperties ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` - | **Connection URI**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` + | **Connection URI Example**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` * - :manual:`authSource ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'authSource' => 'admin' ];`` - | **Connection URI**: ``authSource=admin`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authSource' => 'admin' ];`` + | **Connection URI Example**: ``authSource=admin`` Server Selection and Discovery Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -302,28 +301,28 @@ Server Selection and Discovery Options * - :manual:`localThresholdMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` - | **Connection URI**: ``localThresholdMS=20`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` + | **Connection URI Example**: ``localThresholdMS=20`` * - :manual:`serverSelectionTimeoutMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` - | **Connection URI**: ``serverSelectionTimeoutMS=40000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` + | **Connection URI Example**: ``serverSelectionTimeoutMS=40000`` * - :manual:`serverSelectionTryOnce ` - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` - | **Connection URI**: ``serverSelectionTryOnce=false`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` + | **Connection URI Example**: ``serverSelectionTryOnce=false`` * - :manual:`heartbeatFrequencyMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` - | **Connection URI**: ``heartbeatFrequencyMS=50000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` + | **Connection URI Example**: ``heartbeatFrequencyMS=50000`` * - :manual:`socketCheckIntervalMS ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` - | **Connection URI**: ``socketCheckIntervalMS=4000`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` + | **Connection URI Example**: ``socketCheckIntervalMS=4000`` Miscellaneous Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -338,28 +337,28 @@ Miscellaneous Configuration * - :manual:`appName ` - {+string-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'appName' => 'myApp' ];`` - | **Connection URI**: ``appName=myApp`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'appName' => 'myApp' ];`` + | **Connection URI Example**: ``appName=myApp`` * - :manual:`retryReads ` - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'retryReads' => false ];`` - | **Connection URI**: ``retryReads=false`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryReads' => false ];`` + | **Connection URI Example**: ``retryReads=false`` * - :manual:`retryWrites ` - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'retryWrites' => false ];`` - | **Connection URI**: ``retryWrites=false`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryWrites' => false ];`` + | **Connection URI Example**: ``retryWrites=false`` * - :manual:`loadBalanced ` - {+bool-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'loadBalanced' => true ];`` - | **Connection URI**: ``loadBalanced=false`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'loadBalanced' => true ];`` + | **Connection URI Example**: ``loadBalanced=false`` * - :manual:`srvMaxHosts ` - {+int-data-type+} - - | **MongoDB\\Client**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` - | **Connection URI**: ``srvMaxHosts=5`` + - | **MongoDB\\Client Example**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` + | **Connection URI Example**: ``srvMaxHosts=5`` API Documentation ----------------- From 8f5a381bedde7aa7a905aeb54eb2fca7f015517a Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:27:11 -0500 Subject: [PATCH 16/36] test --- source/connect/connection-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index d4256a5e..ad0faedf 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -98,8 +98,8 @@ Replica Set Options | **Connection URI Example**: ``directConnection=true`` * - :manual:`replicaSet ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` | **Connection URI Example**: ``replicaSet=replicaSetName`` Connection Options From 22966095235c9f03fbcf40e270a405ac89dee58a Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:36:23 -0500 Subject: [PATCH 17/36] make one column --- source/connect/connection-options.txt | 153 +++++++++++--------------- 1 file changed, 63 insertions(+), 90 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index ad0faedf..5559f888 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -118,17 +118,16 @@ Timeout Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`connectTimeoutMS ` - - {+int-data-type+} + - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` | **Connection URI Example**: ``connectTimeoutMS=20000`` * - :manual:`socketTimeoutMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` | **Connection URI Example**: ``socketTimeoutMS=400000`` .. _php-compression-options: @@ -141,17 +140,16 @@ Compression Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`compressors ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` | **Connection URI Example**: ``compressors=snappy,zstd,zlib`` * - :manual:`zlibCompressionLevel ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` | **Connection URI Example**: ``zlibCompressionLevel=3`` Connection Pool Options @@ -162,17 +160,16 @@ Connection Pool Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`maxPoolSize ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: N/A + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: N/A | **Connection URI Example**: ``maxPoolSize=75`` * - :manual:`waitQueueTimeoutMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: N/A + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: N/A | **Connection URI Example**: ``waitQueueTimeoutMS=10000`` Write Concern Options @@ -183,22 +180,21 @@ Write Concern Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`w ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'w' => 'majority' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'w' => 'majority' ];`` | **Connection URI Example**: ``w=majority`` * - :manual:`wTimeoutMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` | **Connection URI Example**: ``wTimeoutMS=10000`` * - :manual:`journal ` - - {+bool-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'journal' => true ];`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'journal' => true ];`` | **Connection URI Example**: ``journal=true`` Read Concern Options @@ -209,12 +205,11 @@ Read Concern Options :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`readConcernLevel ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` | **Connection URI Example**: ``readConcernLevel=majority`` Read Preference Options @@ -223,42 +218,25 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :width: 20 20 60 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`readPreference ` - - ``int`` or ``string`` - - **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` - - **Connection URI Example**: ``readPreference=secondaryPreferred`` - - For a complete list of the available values for this option, see the - `MongoDB\\Driver\\ReadPreference `__ - API documentation. + - | **Data Type**: `MongoDB\\Driver\\ReadPreference `__ + | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` + | + | **Connection URI Example**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` | **Connection URI Example**: ``maxStalenessSeconds=30`` * - :manual:`readPreferenceTags ` - - ``array`` - - **MongoDB\\Client Example**: - - .. code-block:: - :copyable: false - - $uriOptions = [ - 'readPreferenceTags' => [ - [ 'region' => 'east' ], - [ 'region' => 'west'] - ] - ]; - - **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` + - | **Data Type**: ``array`` + | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreferenceTags' => [ [ 'region' => 'east' ], [ 'region' => 'west'] ] ];`` + | **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ @@ -266,25 +244,23 @@ Authentication Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 30 10 60 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`authMechanism ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` | **Connection URI Example**: ``authMechanism=MONGODB-X509`` * - :manual:`authMechanismProperties ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` | **Connection URI Example**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` * - :manual:`authSource ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authSource' => 'admin' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'authSource' => 'admin' ];`` | **Connection URI Example**: ``authSource=admin`` Server Selection and Discovery Options @@ -293,35 +269,33 @@ Server Selection and Discovery Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 35 10 55 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`localThresholdMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` | **Connection URI Example**: ``localThresholdMS=20`` * - :manual:`serverSelectionTimeoutMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` | **Connection URI Example**: ``serverSelectionTimeoutMS=40000`` * - :manual:`serverSelectionTryOnce ` - - {+bool-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` | **Connection URI Example**: ``serverSelectionTryOnce=false`` * - :manual:`heartbeatFrequencyMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` | **Connection URI Example**: ``heartbeatFrequencyMS=50000`` * - :manual:`socketCheckIntervalMS ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` | **Connection URI Example**: ``socketCheckIntervalMS=4000`` Miscellaneous Configuration @@ -332,32 +306,31 @@ Miscellaneous Configuration :stub-columns: 1 * - Connection Option - - Data Type - - Syntax + - Description * - :manual:`appName ` - - {+string-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'appName' => 'myApp' ];`` + - | **Data Type**: {+string-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'appName' => 'myApp' ];`` | **Connection URI Example**: ``appName=myApp`` * - :manual:`retryReads ` - - {+bool-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryReads' => false ];`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryReads' => false ];`` | **Connection URI Example**: ``retryReads=false`` * - :manual:`retryWrites ` - - {+bool-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryWrites' => false ];`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryWrites' => false ];`` | **Connection URI Example**: ``retryWrites=false`` * - :manual:`loadBalanced ` - - {+bool-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'loadBalanced' => true ];`` + - | **Data Type**: {+bool-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'loadBalanced' => true ];`` | **Connection URI Example**: ``loadBalanced=false`` * - :manual:`srvMaxHosts ` - - {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` + - | **Data Type**: {+int-data-type+} + | **MongoDB\\Client Example**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` | **Connection URI Example**: ``srvMaxHosts=5`` API Documentation From c90ad5d3e8ec9ba1718104df4ca31d7c0f48318c Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:41:01 -0500 Subject: [PATCH 18/36] test --- source/connect/connection-options.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 5559f888..b30615bf 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -122,7 +122,7 @@ Timeout Options * - :manual:`connectTimeoutMS ` - | **Data Type**: {+int-data-type+} - - | **MongoDB\\Client Example**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` | **Connection URI Example**: ``connectTimeoutMS=20000`` * - :manual:`socketTimeoutMS ` @@ -224,8 +224,9 @@ Read Preference Options * - :manual:`readPreference ` - | **Data Type**: `MongoDB\\Driver\\ReadPreference `__ - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` - | + | **MongoDB\\Client Example**: + | ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` + | | **Connection URI Example**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` @@ -235,7 +236,9 @@ Read Preference Options * - :manual:`readPreferenceTags ` - | **Data Type**: ``array`` - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreferenceTags' => [ [ 'region' => 'east' ], [ 'region' => 'west'] ] ];`` + | **MongoDB\\Client Example**: + | ``$uriOptions = [ 'readPreferenceTags' => [ [ 'region' => 'east' ], [ 'region' => 'west'] ] ];`` + | | **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` Authentication Options @@ -255,8 +258,10 @@ Authentication Options * - :manual:`authMechanismProperties ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-AWS', 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` - | **Connection URI Example**: ``authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:12345`` + | **MongoDB\\Client Example**: + | ``$uriOptions = [ 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` + | + | **Connection URI Example**: ``authMechanismProperties=AWS_SESSION_TOKEN:12345`` * - :manual:`authSource ` - | **Data Type**: {+string-data-type+} From b31f3fcffc6e7d760f846c2b93ffaad638e0d368 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:43:16 -0500 Subject: [PATCH 19/36] test --- source/connect/connection-options.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index b30615bf..56ba067f 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -237,9 +237,17 @@ Read Preference Options * - :manual:`readPreferenceTags ` - | **Data Type**: ``array`` | **MongoDB\\Client Example**: - | ``$uriOptions = [ 'readPreferenceTags' => [ [ 'region' => 'east' ], [ 'region' => 'west'] ] ];`` - | - | **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` + + .. code-block:: php + + $uriOptions = [ + 'readPreferenceTags' => [ + [ 'region' => 'east' ], + [ 'region' => 'west'] + ] + ];`` + + **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ From 790ffdf3d3b0b8fd2f82d65e4a583f7371bcdec8 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:44:28 -0500 Subject: [PATCH 20/36] test --- source/connect/connection-options.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 56ba067f..c78411b3 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -218,6 +218,7 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 40 60 * - Connection Option - Description From 8ca2f3df847cc091c3cf64258cba2e9a3061bf0f Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:45:08 -0500 Subject: [PATCH 21/36] test --- source/connect/connection-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index c78411b3..17de9a12 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -218,7 +218,7 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 40 60 + :widths: 30 70 * - Connection Option - Description From fa9622ae9329dd73fb135df8a59f83dd95656eb0 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:46:06 -0500 Subject: [PATCH 22/36] test --- source/connect/connection-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 17de9a12..24bd06c4 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -218,7 +218,7 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 30 70 + :widths: 20 80 * - Connection Option - Description From 69584e5fc946dd47c999b61715563c7b0cb252ac Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:47:19 -0500 Subject: [PATCH 23/36] test --- source/connect/connection-options.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 24bd06c4..f7e293a9 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -218,16 +218,14 @@ Read Preference Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 20 80 + :widths: 22 78 * - Connection Option - Description * - :manual:`readPreference ` - | **Data Type**: `MongoDB\\Driver\\ReadPreference `__ - | **MongoDB\\Client Example**: - | ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` - | + | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` | **Connection URI Example**: ``readPreference=secondaryPreferred`` * - :manual:`maxStalenessSeconds ` From 96999b32740d45c6b0752da45887575f4e7ad9d2 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:49:09 -0500 Subject: [PATCH 24/36] test --- source/connect/connection-options.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index f7e293a9..e938a23f 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -281,6 +281,7 @@ Server Selection and Discovery Options .. list-table:: :header-rows: 1 :stub-columns: 1 + :widths: 20 80 * - Connection Option - Description From 3d777f0bd4a505dc3ead2c7ea50797d42c8ddc21 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:49:58 -0500 Subject: [PATCH 25/36] test --- source/connect/connection-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index e938a23f..50d22c9c 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -281,7 +281,7 @@ Server Selection and Discovery Options .. list-table:: :header-rows: 1 :stub-columns: 1 - :widths: 20 80 + :widths: 30 70 * - Connection Option - Description From 5779b96ac033a9ce2db4a3d0f9993908249ce71a Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:52:13 -0500 Subject: [PATCH 26/36] add emphasis --- source/connect/connection-options.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 50d22c9c..9606eeb9 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -29,10 +29,6 @@ Set Connection Options You can configure your connection by specifying options in the connection URI or by passing them to the ``MongoDB\Client`` constructor. -.. TODO: --code samples -- move information to right colummn of tables - .. _php-connection-uri: Using the Connection URI @@ -48,7 +44,7 @@ the connection URI contains the ``tls`` option with a value of ``true`` and the :copyable: true :start-after: // start-connection-uri :end-before: // end-connection-uri - :emphasize-lines: 8 + :emphasize-lines: 4, 7 .. _php-client-object: From 3c2a761696b49478379c6869fbbec98d4e8c4d69 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:54:12 -0500 Subject: [PATCH 27/36] remove extra file --- source/connect/py-connect.txt | 265 ---------------------------------- 1 file changed, 265 deletions(-) delete mode 100644 source/connect/py-connect.txt diff --git a/source/connect/py-connect.txt b/source/connect/py-connect.txt deleted file mode 100644 index 2c6637e1..00000000 --- a/source/connect/py-connect.txt +++ /dev/null @@ -1,265 +0,0 @@ -.. _pymongo-connection-options: - -========================== -Specify Connection Options -========================== - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -.. facet:: - :name: genre - :values: reference - -.. meta:: - :keywords: connection string, URI, server, Atlas, settings, configure - -Overview --------- - -This section describes the MongoDB connection and authentication options -available in {+driver-short+}. You can configure your connection using either -the connection URI or arguments to the ``MongoClient`` constructor. - -.. _pymongo-connection-uri: - -Using the Connection URI -~~~~~~~~~~~~~~~~~~~~~~~~ - -If you pass a connection URI to the ``MongoClient`` constructor, you can include -connection options in the string as ``=`` pairs. In the following example, -the connection URI contains the ``connectTimeoutMS`` option with a value of ``60000`` -and the ``tls`` option with a value of ``true``: - -.. code-block:: python - - uri = "mongodb://:/?connectTimeoutMS=60000&tls=true" - client = pymongo.MongoClient(uri) - -.. _pymongo-mongo-client-settings: - -Using a ``MongoClient`` -~~~~~~~~~~~~~~~~~~~~~~~ - -You can pass connection options as arguments to the ``MongoClient`` constructor -instead of including them in your connection URI. -Configuring the connection this way makes it easier to -change settings at runtime and helps you catch errors during compilation. -The following example shows how to use the ``MongoClient`` constructor to set -connection options: - -.. code-block:: python - - uri = "mongodb://:" - client = pymongo.MongoClient(uri, connectTimeoutMS=60000, tls=True) - -Connection Options ------------------- - -The following sections describe the connection options available in {+driver-short+}. -If a ``MongoClient`` parameter maps to more than one -option in the connection string, the **Connection URI Example** shows all -relevant options. - -.. todo: .. note:: - If you're using a query parameter for a time duration, the value must be in - milliseconds. For example, to specify 60 seconds, use the value ``60000``. If you're - using a ``MongoClientSettings`` object for a time duration, use the appropriate - ``TimeSpan`` value. - -Network Compression -~~~~~~~~~~~~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :widths: 30 70 - - * - Connection Option - - Description - - * - **compressors** - - | The preferred compression types, in order, for wire-protocol messages sent to - | or received from the server. The driver uses the first of these compression types - | that the server supports. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``None`` - | **MongoClient Example**: ``compressors = "snappy,zstd,zlib"`` - | **Connection URI Example**: ``compressors=snappy,zstd,zlib`` - - * - **zlibCompressionLevel** - - | The compression level for zlib to use. This option accepts - | an integer value between ``-1`` and ``9``: - | - | - **-1:** (Default). zlib uses its default compression level (usually ``6``). - | - **0:** No compression. - | - **1:** Fastest speed but lowest compression. - | - **9:** Best compression but slowest speed. - | - | **Data Type**: {+int-data-type+} - | **Default**: ``-1`` - | **MongoClient Example**: ``zlibCompressionLevel = 3`` - | **Connection URI Example**: ``zlibCompressionLevel=3`` - -Timeouts -~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :widths: 30 70 - - * - Connection Option - - Description - - * - **timeoutMS** - - | The number of milliseconds each driver operation must complete within. If an - | operation doesn't finish in the specified time, {+driver-short+} raises a timeout exception. - | For more information, see :ref:``. - | - | **Data Type**: ``int`` - | **Default**: ``None`` - | **MongoClient Example**: ``timeoutMS = 10000`` - | **Connection URI Example**: ``timeoutMs=10000`` - -Server Selection -~~~~~~~~~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :widths: 30 70 - - * - Connection Option - - Description - - * - **server_selector** - - | A user-defined Python function called by {+driver-short+} to choose the server - | to run an operation against. For more information, see - | :ref:``. - | - | **Data Type**: ``callable`` - | **Default**: ``None`` - | **MongoClient Example**: ``server_selector = your_function`` - | **Connection URI Example**: N/A - -Authentication -~~~~~~~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :widths: 30 70 - - * - Connection Option - - Description - - * - **authMechanism** - - | The mechanism {+driver-short+} uses to authenticate the application. Valid - | options are defined in `MECHANISMS. <{+api-root+}pymongo/database.html#pymongo.auth.MECHANISMS>`__ - | - | **Data Type**: {+string-data-type+} - | **Default**: ``"SCRAM-SHA-256"`` when connecting to MongoDB v4.0 or later. - | ``"SCRAM-SHA-1"`` when connecting to MongoDB v3.0 through v3.13. - | **MongoClient Example**: ``authMechanism = "MONGODB-X509"`` - | **Connection URI Example**: ``authMechanism=MONGODB-X509`` - - * - **authMechanismProperties** - - | Options specific to the authentication mechanism. Not needed for all authentication - | mechanisms. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``""`` - | **MongoClient Example**: ``authMechanismProperties = "AWS_SESSION_TOKEN:12345"`` - | **Connection URI Example**: ``authMechanismProperties=AWS_SESSION_TOKEN:12435`` - - * - **authSource** - - | The database to authenticate against. - | - | **Data Type**: {+string-data-type+} - | **Default**: The database in the connection URI, or ``"admin"`` if none is provided - | **MongoClient Example**: ``authSource = "admin"`` - | **Connection URI Example**: ``authSource=admin`` - - * - **username** - - | The username for authentication. When this option is included in a connection - | URI, you must percent-escape it. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``""`` - | **MongoClient Example**: ``username = "my user"`` - | **Connection URI Example**: ``username=my+user`` - - * - **password** - - | The password for authentication. When this option is included in a connection - | URI, you must percent-escape it. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``""`` - | **MongoClient Example**: ``password = "strong password"`` - | **Connection URI Example**: ``password=strong+password`` - -For more information about the connection option in this section, see :ref:`pymongo-auth`. - -Read and Write Operations -~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :widths: 30 70 - - * - Connection Option - - Description - - * - **replicaSet** - - | Specifies the name of the replica set to connect to. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``null`` - | **MongoClient Example**: ``replicaSet='replicaSetName'`` - | **Connection URI Example**: ``replicaSet=replicaSetName`` - - * - **directConnection** - - | Whether to connect only to the primary member of the replica set. - | - | **Data Type**: {+bool-data-type+} - | **Default**: ``False`` - | **MongoClient Example**: ``directConnection=True`` - | **Connection URI Example**: ``directConnection=true`` - - * - **readPreference** - - | Specifies the client's read-preference settings. - | - | **Data Type**: `read_preferences <{+api-root+}pymongo/read_preferences.html#pymongo.read_preferences>`__ - | **Default**: ``ReadPreference.Primary`` - | **MongoClient Example**: ``readPreference=ReadPreference.SECONDARY_PREFERRED`` - | **Connection URI Example**: ``readPreference=secondaryPreferred`` - - * - **readConcern** - - | Specifies the client's read-concern settings. For more information, see :manual:``. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``None`` - | **MongoClient Example**: ``readConcern="majority"`` - | **Connection URI Example**: ``readConcern=majority`` - - * - **writeConcern** - - | Specifies the client's write-concern settings. For more information, see - :manual:``. - | - | **Data Type**: {+string-data-type+} - | **Default**: ``None`` - | **MongoClient Example**: ``writeConcern="majority"`` - | **Connection URI Example**: ``writeConcern=majority`` - - * - **localThresholdMS** - - | The latency window for a replica-set members eligibility. If a member's - round trip ping takes longer than the fastest server's round-trip ping - time plus this value, the server isn't eligible for selection. - | - | **Data Type**: `read_preferences <{+api-root+}pymongo/read_preferences.html#pymongo.read_preferences>`__ - | **Default**: ``{+int-data-type+}`` - | **MongoClient Example**: ``localThresholdMS=35`` - | **Connection URI Example**: ``localThresholdMS=35`` - -For more information about the connection option in this section, see :ref:`pymongo-databases-collections`. From a1470a61e1a8901baa3313fb9dbbd9d4af298b03 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:55:12 -0500 Subject: [PATCH 28/36] add source constant --- snooty.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/snooty.toml b/snooty.toml index d1f398fd..f17a826b 100644 --- a/snooty.toml +++ b/snooty.toml @@ -29,3 +29,4 @@ driver-short = "PHP library" string-data-type = "``string``" bool-data-type = "``bool``" int-data-type = "``int``" +mdb-server = "MongoDB Server" From 57e67284514593e06d775ec80e5d195f4791240e Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:41:08 -0500 Subject: [PATCH 29/36] Apply suggestions from code review Co-authored-by: Nora Reidy --- source/connect/connection-options.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 9606eeb9..65d8bd26 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -36,8 +36,8 @@ Using the Connection URI If you pass a connection URI to the ``MongoDB\Client`` constructor, you can include connection options in the URI as ``=`` pairs. In the following example, -the connection URI contains the ``tls`` option with a value of ``true`` and the -``tlsCertificateKeyFile`` option with a value of ``/path/to/file.pem``: +the connection URI sets the ``tls`` option to ``true`` and the +``tlsCertificateKeyFile`` option to ``/path/to/file.pem``: .. literalinclude:: /includes/connect/connection-options.php :language: php @@ -56,7 +56,7 @@ instead of including them in your connection URI. Configuring the connection this way makes it easier to change settings at runtime and helps you catch errors during compilation. -The following example shows how to use the the ``$uriOptions`` parameter of the +The following example shows how to use the ``$uriOptions`` parameter of the ``MongoDB\Client`` constructor to set connection options: .. literalinclude:: /includes/connect/connection-options.php @@ -335,7 +335,7 @@ Miscellaneous Configuration * - :manual:`loadBalanced ` - | **Data Type**: {+bool-data-type+} | **MongoDB\\Client Example**: ``$uriOptions = [ 'loadBalanced' => true ];`` - | **Connection URI Example**: ``loadBalanced=false`` + | **Connection URI Example**: ``loadBalanced=true`` * - :manual:`srvMaxHosts ` - | **Data Type**: {+int-data-type+} From db5a290214a29e36eeaeda4537cf07527f2be72b Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:43:50 -0500 Subject: [PATCH 30/36] feedback --- snooty.toml | 1 + source/connect/connection-options.txt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/snooty.toml b/snooty.toml index f17a826b..9fa948f9 100644 --- a/snooty.toml +++ b/snooty.toml @@ -26,6 +26,7 @@ php-library = "MongoDB PHP Library" php-library = "MongoDB PHP Library" api = "https://www.mongodb.com/docs/php-library/current/reference" driver-short = "PHP library" +extension-short = "PHP extension" string-data-type = "``string``" bool-data-type = "``bool``" int-data-type = "``int``" diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 65d8bd26..042b2479 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -345,8 +345,12 @@ Miscellaneous Configuration API Documentation ----------------- -For more information about the types used on this page, see the following API -documentation: +For more information about the ``MongoDB\Client`` class, see the following {+driver-short+} +API documentation: - :ref:`MongoDB\Client ` + +For more information about the ``MongoDB\Driver\ReadPreference`` class, see the following +{+extension-short+} API documentation: + - `MongoDB\\Driver\\ReadPreference `__ \ No newline at end of file From b6088f885e0493dd90c3378f2cf2ad5edef9740b Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:29:46 -0500 Subject: [PATCH 31/36] feedback --- source/connect/connection-options.txt | 4 ++-- source/includes/connect/connection-options.php | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 042b2479..9df8c52d 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -44,7 +44,7 @@ the connection URI sets the ``tls`` option to ``true`` and the :copyable: true :start-after: // start-connection-uri :end-before: // end-connection-uri - :emphasize-lines: 4, 7 + :emphasize-lines: 2,5 .. _php-client-object: @@ -64,7 +64,7 @@ The following example shows how to use the ``$uriOptions`` parameter of the :copyable: true :start-after: // start-client-options :end-before: // end-client-options - :emphasize-lines: 7-10, 13 + :emphasize-lines: 2, 5-8, 11 .. note:: diff --git a/source/includes/connect/connection-options.php b/source/includes/connect/connection-options.php index 57d42a7a..82239241 100644 --- a/source/includes/connect/connection-options.php +++ b/source/includes/connect/connection-options.php @@ -1,6 +1,4 @@ // start-connection-uri -:/?tls=true&tlsCertificateKeyFile=/path/to/file.pem"; @@ -9,8 +7,6 @@ // end-connection-uri // start-client-options -:/"; @@ -23,17 +19,3 @@ // Create a MongoDB client with the URI and options $client = new Client($uri, $uriOptions); // end-client-options - -// start-uri-object -#include -#include -#include - -int main() -{ - mongocxx::instance instance; - mongocxx::uri uri("mongodb://:/?tls=true"); - mongocxx::client client(uri); - auto is_tls_enabled = uri.tls(); -} -// end-uri-object \ No newline at end of file From 7cd7c3004e7c50c683d7a47f6835492ec13ad948 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:30:55 -0500 Subject: [PATCH 32/36] phpclass --- source/connect/connection-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index 9df8c52d..a67b653c 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -64,7 +64,7 @@ The following example shows how to use the ``$uriOptions`` parameter of the :copyable: true :start-after: // start-client-options :end-before: // end-client-options - :emphasize-lines: 2, 5-8, 11 + :emphasize-lines: 5-8, 11 .. note:: @@ -348,7 +348,7 @@ API Documentation For more information about the ``MongoDB\Client`` class, see the following {+driver-short+} API documentation: -- :ref:`MongoDB\Client ` +- :phpclass:`MongoDB\Client` For more information about the ``MongoDB\Driver\ReadPreference`` class, see the following {+extension-short+} API documentation: From 5a519a4826290686b157c236152f843532e4ea52 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:58:23 -0500 Subject: [PATCH 33/36] feedback --- source/connect/connection-options.txt | 170 ++++++++---------- .../includes/connect/connection-options.php | 1 + 2 files changed, 72 insertions(+), 99 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index a67b653c..b34a5cb3 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -53,8 +53,6 @@ Using a MongoDB\\Client Object You can pass connection options to the ``MongoDB\Client`` constructor instead of including them in your connection URI. -Configuring the connection this way makes it easier to -change settings at runtime and helps you catch errors during compilation. The following example shows how to use the ``$uriOptions`` parameter of the ``MongoDB\Client`` constructor to set connection options: @@ -68,15 +66,30 @@ The following example shows how to use the ``$uriOptions`` parameter of the .. note:: - If you specify an option in both the ``MongoDB\Client`` object and in the connection - URI, the value in the ``MongoDB\Client`` object takes precedence. + If you specify an option in both the ``$uriOptions`` parameter and in the connection + URI, the value in ``$uriOptions`` takes precedence. Connection URI Options ---------------------- The following sections describe the options that you can set for your connection to MongoDB. Each connection option links to its corresponding -entry in the {+mdb-server+} manual. +entry in the {+mdb-server+} manual. + +.. important:: Percent-Encoding + + If the value of a connection option contains special characters, you must + :wikipedia:`percent-encode ` the value before including it + in the connection URI. You can use the ``rawurlencode()`` method to encode + these values according to the URI syntax specified in RFC 3986. + + Don't percent-encode connection options when including them in the + ``$uriOptions`` parameter. + + To learn more, see the following resources: + + - `RFC 3986 `__ + - `rawurlencode <{+php-manual+}/rawurlencode>`__ in the PHP manual Replica Set Options ~~~~~~~~~~~~~~~~~~~ @@ -88,14 +101,14 @@ Replica Set Options * - Connection Option - Description - * - :manual:`directConnection ` + * - :manual:`directConnection ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'directConnection' => true ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['directConnection' => true];`` | **Connection URI Example**: ``directConnection=true`` - * - :manual:`replicaSet ` + * - :manual:`replicaSet ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'replicaSet' => 'replicaSetName' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['replicaSet' => 'replicaSetName'];`` | **Connection URI Example**: ``replicaSet=replicaSetName`` Connection Options @@ -116,14 +129,14 @@ Timeout Options * - Connection Option - Description - * - :manual:`connectTimeoutMS ` + * - :manual:`connectTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'connectTimeoutMS' => 20000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['connectTimeoutMS' => 20000];`` | **Connection URI Example**: ``connectTimeoutMS=20000`` - * - :manual:`socketTimeoutMS ` + * - :manual:`socketTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketTimeoutMS' => 400000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['socketTimeoutMS' => 400000];`` | **Connection URI Example**: ``socketTimeoutMS=400000`` .. _php-compression-options: @@ -138,36 +151,16 @@ Compression Options * - Connection Option - Description - * - :manual:`compressors ` + * - :manual:`compressors ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'compressors' => 'snappy,zstd,zlib' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['compressors' => 'snappy,zstd,zlib'];`` | **Connection URI Example**: ``compressors=snappy,zstd,zlib`` - * - :manual:`zlibCompressionLevel ` + * - :manual:`zlibCompressionLevel ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'zlibCompressionLevel' => 3 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['zlibCompressionLevel' => 3];`` | **Connection URI Example**: ``zlibCompressionLevel=3`` -Connection Pool Options -~~~~~~~~~~~~~~~~~~~~~~~ - -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - - * - Connection Option - - Description - - * - :manual:`maxPoolSize ` - - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: N/A - | **Connection URI Example**: ``maxPoolSize=75`` - - * - :manual:`waitQueueTimeoutMS ` - - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: N/A - | **Connection URI Example**: ``waitQueueTimeoutMS=10000`` - Write Concern Options ~~~~~~~~~~~~~~~~~~~~~ @@ -178,19 +171,19 @@ Write Concern Options * - Connection Option - Description - * - :manual:`w ` + * - :manual:`w ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'w' => 'majority' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['w' => 'majority'];`` | **Connection URI Example**: ``w=majority`` - * - :manual:`wTimeoutMS ` + * - :manual:`wTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'wTimeoutMS' => 10000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['wTimeoutMS' => 10000];`` | **Connection URI Example**: ``wTimeoutMS=10000`` - * - :manual:`journal ` + * - :manual:`journal ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'journal' => true ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['journal' => true];`` | **Connection URI Example**: ``journal=true`` Read Concern Options @@ -203,9 +196,9 @@ Read Concern Options * - Connection Option - Description - * - :manual:`readConcernLevel ` + * - :manual:`readConcernLevel ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readConcernLevel' => 'majority' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['readConcernLevel' => 'majority'];`` | **Connection URI Example**: ``readConcernLevel=majority`` Read Preference Options @@ -219,57 +212,36 @@ Read Preference Options * - Connection Option - Description - * - :manual:`readPreference ` + * - :manual:`readPreference ` - | **Data Type**: `MongoDB\\Driver\\ReadPreference `__ - | **MongoDB\\Client Example**: ``$uriOptions = [ 'readPreference' => 'secondaryPreferred' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['readPreference' => 'secondaryPreferred'];`` | **Connection URI Example**: ``readPreference=secondaryPreferred`` - * - :manual:`maxStalenessSeconds ` + * - :manual:`maxStalenessSeconds ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'maxStalenessSeconds' => 30 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['maxStalenessSeconds' => 30];`` | **Connection URI Example**: ``maxStalenessSeconds=30`` - * - :manual:`readPreferenceTags ` + * - :manual:`readPreferenceTags ` - | **Data Type**: ``array`` | **MongoDB\\Client Example**: .. code-block:: php $uriOptions = [ - 'readPreferenceTags' => [ - [ 'region' => 'east' ], - [ 'region' => 'west'] - ] - ];`` + 'readPreferenceTags' => [ + ['dc' => 'ny', 'rack' => 'r1'], + [], + ], + ]; - **Connection URI Example**: ``readPreferenceTags=region:east,region:west`` + **Connection URI Example**: ``readPreferenceTags=dc:ny,rack:r1&readPreferenceTags=`` Authentication Options ~~~~~~~~~~~~~~~~~~~~~~ -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - - * - Connection Option - - Description - - * - :manual:`authMechanism ` - - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authMechanism' => 'MONGODB-X509' ];`` - | **Connection URI Example**: ``authMechanism=MONGODB-X509`` - - * - :manual:`authMechanismProperties ` - - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: - | ``$uriOptions = [ 'authMechanismProperties' => 'AWS_SESSION_TOKEN:12345' ];`` - | - | **Connection URI Example**: ``authMechanismProperties=AWS_SESSION_TOKEN:12345`` - - * - :manual:`authSource ` - - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'authSource' => 'admin' ];`` - | **Connection URI Example**: ``authSource=admin`` +To learn about the authentication options available in the {+driver-short+}, see +:ref:`Authentication Mechanisms. ` Server Selection and Discovery Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -282,29 +254,29 @@ Server Selection and Discovery Options * - Connection Option - Description - * - :manual:`localThresholdMS ` + * - :manual:`localThresholdMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'localThresholdMS' => 20 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['localThresholdMS' => 20];`` | **Connection URI Example**: ``localThresholdMS=20`` - * - :manual:`serverSelectionTimeoutMS ` + * - :manual:`serverSelectionTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTimeoutMS' => 40000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['serverSelectionTimeoutMS' => 5000];`` | **Connection URI Example**: ``serverSelectionTimeoutMS=40000`` - * - :manual:`serverSelectionTryOnce ` + * - :manual:`serverSelectionTryOnce ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'serverSelectionTryOnce' => false ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['serverSelectionTryOnce' => false];`` | **Connection URI Example**: ``serverSelectionTryOnce=false`` - * - :manual:`heartbeatFrequencyMS ` + * - :manual:`heartbeatFrequencyMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'heartbeatFrequencyMS' => 50000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['heartbeatFrequencyMS' => 50000];`` | **Connection URI Example**: ``heartbeatFrequencyMS=50000`` - * - :manual:`socketCheckIntervalMS ` + * - :manual:`socketCheckIntervalMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'socketCheckIntervalMS' => 4000 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['socketCheckIntervalMS' => 4000];`` | **Connection URI Example**: ``socketCheckIntervalMS=4000`` Miscellaneous Configuration @@ -317,29 +289,29 @@ Miscellaneous Configuration * - Connection Option - Description - * - :manual:`appName ` + * - :manual:`appName ` - | **Data Type**: {+string-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'appName' => 'myApp' ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['appName' => 'myApp'];`` | **Connection URI Example**: ``appName=myApp`` - * - :manual:`retryReads ` + * - :manual:`retryReads ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryReads' => false ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['retryReads' => false];`` | **Connection URI Example**: ``retryReads=false`` - * - :manual:`retryWrites ` + * - :manual:`retryWrites ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'retryWrites' => false ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['retryWrites' => false];`` | **Connection URI Example**: ``retryWrites=false`` - * - :manual:`loadBalanced ` + * - :manual:`loadBalanced ` - | **Data Type**: {+bool-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'loadBalanced' => true ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['loadBalanced' => true];`` | **Connection URI Example**: ``loadBalanced=true`` - * - :manual:`srvMaxHosts ` + * - :manual:`srvMaxHosts ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = [ 'srvMaxHosts' => 5 ];`` + | **MongoDB\\Client Example**: ``$uriOptions = ['srvMaxHosts' => 5];`` | **Connection URI Example**: ``srvMaxHosts=5`` API Documentation diff --git a/source/includes/connect/connection-options.php b/source/includes/connect/connection-options.php index 82239241..f6297065 100644 --- a/source/includes/connect/connection-options.php +++ b/source/includes/connect/connection-options.php @@ -11,6 +11,7 @@ $uri = "mongodb://:/"; // Set the connection options +// Replace the placeholder with the actual path to the certificate key file $uriOptions = [ 'tls' => true, 'tlsCertificateKeyFile' => '/path/to/file.pem' From 2eb98eaf20a67d320d9b68fe6bd6740e51a12ce1 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:08:51 -0500 Subject: [PATCH 34/36] add toc link --- source/connect.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/connect.txt b/source/connect.txt index cc4ff021..be634ba3 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -24,6 +24,7 @@ Connect to MongoDB /connect/client /connect/connection-targets + /connect/connection-options /connect/tls .. TODO: From 20a48177152ff4992cfdf0bb274404336ddc5974 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:10:59 -0500 Subject: [PATCH 35/36] stable api link --- source/connect.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/connect.txt b/source/connect.txt index be634ba3..30e22002 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -26,9 +26,6 @@ Connect to MongoDB /connect/connection-targets /connect/connection-options /connect/tls - -.. TODO: - /connect/connection-options /connect/stable-api Overview From dca45653ea0c04393b1b72260d188b0c5f544e66 Mon Sep 17 00:00:00 2001 From: Mike Woofter <108414937+mongoKart@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:50:35 -0500 Subject: [PATCH 36/36] Apply suggestions from code review Co-authored-by: Jeremy Mikola --- source/connect/connection-options.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt index b34a5cb3..5cbcab35 100644 --- a/source/connect/connection-options.txt +++ b/source/connect/connection-options.txt @@ -131,13 +131,13 @@ Timeout Options * - :manual:`connectTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = ['connectTimeoutMS' => 20000];`` - | **Connection URI Example**: ``connectTimeoutMS=20000`` + | **MongoDB\\Client Example**: ``$uriOptions = ['connectTimeoutMS' => 2000];`` + | **Connection URI Example**: ``connectTimeoutMS=2000`` * - :manual:`socketTimeoutMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = ['socketTimeoutMS' => 400000];`` - | **Connection URI Example**: ``socketTimeoutMS=400000`` + | **MongoDB\\Client Example**: ``$uriOptions = ['socketTimeoutMS' => 20000];`` + | **Connection URI Example**: ``socketTimeoutMS=20000`` .. _php-compression-options: @@ -262,7 +262,7 @@ Server Selection and Discovery Options * - :manual:`serverSelectionTimeoutMS ` - | **Data Type**: {+int-data-type+} | **MongoDB\\Client Example**: ``$uriOptions = ['serverSelectionTimeoutMS' => 5000];`` - | **Connection URI Example**: ``serverSelectionTimeoutMS=40000`` + | **Connection URI Example**: ``serverSelectionTimeoutMS=5000`` * - :manual:`serverSelectionTryOnce ` - | **Data Type**: {+bool-data-type+} @@ -271,8 +271,8 @@ Server Selection and Discovery Options * - :manual:`heartbeatFrequencyMS ` - | **Data Type**: {+int-data-type+} - | **MongoDB\\Client Example**: ``$uriOptions = ['heartbeatFrequencyMS' => 50000];`` - | **Connection URI Example**: ``heartbeatFrequencyMS=50000`` + | **MongoDB\\Client Example**: ``$uriOptions = ['heartbeatFrequencyMS' => 30000];`` + | **Connection URI Example**: ``heartbeatFrequencyMS=30000`` * - :manual:`socketCheckIntervalMS ` - | **Data Type**: {+int-data-type+}