From 87354c76499ada895df8be4478ba781a2b32b88c Mon Sep 17 00:00:00 2001 From: Jordan Smith Date: Mon, 12 Aug 2024 13:06:34 -0700 Subject: [PATCH 1/2] Update username and password placeholders --- source/connect.txt | 12 +++++------ source/connect/csot.txt | 6 +++--- source/connect/network-compression.txt | 4 ++-- source/connect/server-selection.txt | 2 +- source/connect/stable-api.txt | 4 ++-- source/includes/connect/ca-file-tabs.rst | 4 ++-- source/includes/connect/client-cert-tabs.rst | 4 ++-- source/includes/connect/compression-tabs.rst | 4 ++-- source/includes/connect/crl-tabs.rst | 2 +- .../connect/disable-cert-validation-tabs.rst | 4 ++-- .../disable-host-verification-tabs.rst | 4 ++-- source/includes/connect/insecure-tls-tabs.rst | 4 ++-- source/includes/connect/key-file-password.rst | 4 ++-- source/includes/connect/ocsp-tabs.rst | 2 +- source/includes/connect/tls-tabs.rst | 4 ++-- source/security.txt | 18 ++++++++--------- source/security/authentication.txt | 20 +++++++++---------- source/security/enterprise-authentication.txt | 6 +++--- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/source/connect.txt b/source/connect.txt index 700c33cb..1abda5a8 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -181,7 +181,7 @@ zlib Compression Level .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", compressors = "zlib", zlibCompressionLevel=) @@ -190,7 +190,7 @@ zlib Compression Level .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "compressors=zlib" "zlibCompressionLevel=") client = pymongo.MongoClient(uri) @@ -203,7 +203,7 @@ Server Selection .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", server_selector=) To learn more about customizing server selection, see @@ -216,7 +216,7 @@ To learn more about customizing server selection, see from pymongo.server_api import ServerApi - client = pymongo.MongoClient("mongodb://:@", + client = pymongo.MongoClient("mongodb://:@", server_api=ServerApi("<{+stable-api+} version>")) To learn more about the {+stable-api+}, see :ref:`pymongo-stable-api`. @@ -244,7 +244,7 @@ timeoutMS Connection Option .. code-block:: python - client = pymongo.MongoClient("mongodb://:@", + client = pymongo.MongoClient("mongodb://:@", timeoutMS=) .. tab:: Connection String @@ -252,7 +252,7 @@ timeoutMS Connection Option .. code-block:: python - uri = "mongodb://:@/?timeoutMS=" + uri = "mongodb://:@/?timeoutMS=" client = pymongo.MongoClient(uri) To learn more about client-side timeouts, see :ref:`pymongo-csot`. diff --git a/source/connect/csot.txt b/source/connect/csot.txt index c134fa41..b1014624 100644 --- a/source/connect/csot.txt +++ b/source/connect/csot.txt @@ -136,7 +136,7 @@ The following code examples use the ``timeoutMS`` option to specify a timeout of .. code-block:: python :emphasize-lines: 2 - client = pymongo.MongoClient("mongodb://:@", + client = pymongo.MongoClient("mongodb://:@", timeoutMS=10000) .. tab:: Connection String @@ -145,7 +145,7 @@ The following code examples use the ``timeoutMS`` option to specify a timeout of .. code-block:: python :emphasize-lines: 1 - uri = "mongodb://:@/?timeoutMS=10000" + uri = "mongodb://:@/?timeoutMS=10000" client = pymongo.MongoClient(uri) If you specify the ``timeoutMS`` option, {+driver-short+} automatically applies the @@ -161,7 +161,7 @@ a timeout of 10 seconds, then call the ``insert_one()`` and .. code-block:: python - uri = "mongodb://:@/?timeoutMS=10000" + uri = "mongodb://:@/?timeoutMS=10000" client = pymongo.MongoClient(uri) coll = client["test-db"]["test-collection"] diff --git a/source/connect/network-compression.txt b/source/connect/network-compression.txt index 5d365580..0cc60ecb 100644 --- a/source/connect/network-compression.txt +++ b/source/connect/network-compression.txt @@ -77,7 +77,7 @@ The following code example specifies the ``zlib`` compression algorithm and a va .. code-block:: python :emphasize-lines: 2-3 - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", compressors = "zlib", zlibCompressionLevel=1) @@ -87,7 +87,7 @@ The following code example specifies the ``zlib`` compression algorithm and a va .. code-block:: python :emphasize-lines: 2-3 - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "compressors=zlib" "zlibCompressionLevel=1") client = pymongo.MongoClient(uri) diff --git a/source/connect/server-selection.txt b/source/connect/server-selection.txt index b0f46621..ddff92c4 100644 --- a/source/connect/server-selection.txt +++ b/source/connect/server-selection.txt @@ -121,7 +121,7 @@ constructor and pass the ``server_selector`` argument with your function name as .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", server_selector=prefer_local) API Documentation diff --git a/source/connect/stable-api.txt b/source/connect/stable-api.txt index 7900e783..5289fc05 100644 --- a/source/connect/stable-api.txt +++ b/source/connect/stable-api.txt @@ -56,7 +56,7 @@ The following code example shows how to specify {+stable-api+} version 1: from pymongo import MongoClient from pymongo.server_api import ServerApi - client = MongoClient("mongodb://:@", + client = MongoClient("mongodb://:@", server_api=ServerApi("1")) Once you create a ``MongoClient`` instance with @@ -101,7 +101,7 @@ The following code example shows how you can use these parameters when construct from pymongo import MongoClient from pymongo.server_api import ServerApi - client = MongoClient("mongodb://:@", + client = MongoClient("mongodb://:@", server_api=ServerApi("1", strict=True, deprecation_errors=True)) diff --git a/source/includes/connect/ca-file-tabs.rst b/source/includes/connect/ca-file-tabs.rst index b7aad4aa..555d9b6e 100644 --- a/source/includes/connect/ca-file-tabs.rst +++ b/source/includes/connect/ca-file-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsCAFile="/path/to/ca.pem") @@ -14,5 +14,5 @@ .. code-block:: python - uri = "mongodb://:@:/?tls=true&tlsCAFile=/path/to/ca.pem" + uri = "mongodb://:@:/?tls=true&tlsCAFile=/path/to/ca.pem" client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/client-cert-tabs.rst b/source/includes/connect/client-cert-tabs.rst index db83d31f..81fc4d37 100644 --- a/source/includes/connect/client-cert-tabs.rst +++ b/source/includes/connect/client-cert-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsCertificateKeyFile='/path/to/client.pem') @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@/?" + uri = ("mongodb://:@/?" "tls=true" "&tlsCertificateKeyFile=path/to/client.pem") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/compression-tabs.rst b/source/includes/connect/compression-tabs.rst index e5943697..98eb16f6 100644 --- a/source/includes/connect/compression-tabs.rst +++ b/source/includes/connect/compression-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", compressors = "snappy,zstd,zlib") .. tab:: Connection String @@ -13,6 +13,6 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "compressors=snappy,zstd,zlib") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/crl-tabs.rst b/source/includes/connect/crl-tabs.rst index 2acfe7b2..3aacff00 100644 --- a/source/includes/connect/crl-tabs.rst +++ b/source/includes/connect/crl-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsCRLFile="/path/to/crl.pem") diff --git a/source/includes/connect/disable-cert-validation-tabs.rst b/source/includes/connect/disable-cert-validation-tabs.rst index ad86e61d..2a586d26 100644 --- a/source/includes/connect/disable-cert-validation-tabs.rst +++ b/source/includes/connect/disable-cert-validation-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsAllowInvalidCertificates=True) @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "tls=true" "&tlsAllowInvalidCertificates=true") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/disable-host-verification-tabs.rst b/source/includes/connect/disable-host-verification-tabs.rst index 127c9726..d600a306 100644 --- a/source/includes/connect/disable-host-verification-tabs.rst +++ b/source/includes/connect/disable-host-verification-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsAllowInvalidHostnames=True) @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "tls=true" "&tlsAllowInvalidHostnames=true") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/insecure-tls-tabs.rst b/source/includes/connect/insecure-tls-tabs.rst index ce3f4f81..503d0344 100644 --- a/source/includes/connect/insecure-tls-tabs.rst +++ b/source/includes/connect/insecure-tls-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@", + client = pymongo.MongoClient("mongodb://:@", tls=True, tlsInsecure=True) @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "tls=true" "&tlsInsecure=true") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/key-file-password.rst b/source/includes/connect/key-file-password.rst index e60ef905..8c75a415 100644 --- a/source/includes/connect/key-file-password.rst +++ b/source/includes/connect/key-file-password.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@", + client = pymongo.MongoClient("mongodb://:@", tls=True, tlsCertificateKeyFile='/path/to/client.pem', tlsCertificateKeyFilePassword=) @@ -15,7 +15,7 @@ .. code-block:: python - uri = ("mongodb://:@/?" + uri = ("mongodb://:@/?" "tls=true" "&tlsCertificateKeyFile=path/to/client.pem" "&tlsCertificateKeyFilePassword=") diff --git a/source/includes/connect/ocsp-tabs.rst b/source/includes/connect/ocsp-tabs.rst index 20a77db8..52695a56 100644 --- a/source/includes/connect/ocsp-tabs.rst +++ b/source/includes/connect/ocsp-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", tls=True, tlsDisableOCSPEndpointCheck=True) diff --git a/source/includes/connect/tls-tabs.rst b/source/includes/connect/tls-tabs.rst index 90b17c29..df592c65 100644 --- a/source/includes/connect/tls-tabs.rst +++ b/source/includes/connect/tls-tabs.rst @@ -5,11 +5,11 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@", tls=True) + client = pymongo.MongoClient("mongodb://:@", tls=True) .. tab:: Connection String :tabid: connectionstring .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:?tls=true") \ No newline at end of file + client = pymongo.MongoClient("mongodb://:@:?tls=true") \ No newline at end of file diff --git a/source/security.txt b/source/security.txt index bfacb036..b4509001 100644 --- a/source/security.txt +++ b/source/security.txt @@ -63,8 +63,8 @@ SCRAM-SHA-256 .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authSource="", authMechanism="SCRAM-SHA-256") @@ -93,8 +93,8 @@ SCRAM-SHA-1 .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authSource="", authMechanism="SCRAM-SHA-1") @@ -371,9 +371,9 @@ Windows .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", + username="", authMechanism="GSSAPI", - password="", + password="", authMechanismProperties="SERVICE_NAME:, CANONICALIZE_HOST_NAME:true, SERVICE_REALM:") @@ -410,8 +410,8 @@ PLAIN SASL .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authMechanism="PLAIN", tls=True) @@ -420,7 +420,7 @@ PLAIN SASL .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "&authMechanism=PLAIN" "&tls=true") client = pymongo.MongoClient(uri) diff --git a/source/security/authentication.txt b/source/security/authentication.txt index 9d674e80..9221b0cd 100644 --- a/source/security/authentication.txt +++ b/source/security/authentication.txt @@ -44,9 +44,9 @@ running MongoDB v4.0 or later. To authenticate with this mechanism, set the following connection options: -- ``username``: The username to authenticate. Percent-encode this value before including +- ``db_username``: The username to authenticate. Percent-encode this value before including it in a connection URI. -- ``password``: The password to authenticate. Percent-encode this value before including +- ``db_password``: The password to authenticate. Percent-encode this value before including it in a connection URI. - ``authSource``: The MongoDB database to authenticate against. By default, {+driver-short+} authenticates against the database in the connection @@ -64,8 +64,8 @@ You can set these options in two ways: by passing arguments to the .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authSource="", authMechanism="SCRAM-SHA-256") @@ -74,7 +74,7 @@ You can set these options in two ways: by passing arguments to the .. code-block:: python - uri = ("mongodb://:" + uri = ("mongodb://:" "@:/?" "authSource=" "&authMechanism=SCRAM-SHA-256") @@ -91,9 +91,9 @@ running MongoDB v3.6. To authenticate with this mechanism, set the following connection options: -- ``username``: The username to authenticate. Percent-encode this value before including +- ``db_username``: The username to authenticate. Percent-encode this value before including it in a connection URI. -- ``password``: The password to authenticate. Percent-encode this value before including +- ``db_password``: The password to authenticate. Percent-encode this value before including it in a connection URI. - ``authSource``: The MongoDB database to authenticate against. By default, {+driver-short+} authenticates against the ``admin`` database. @@ -110,8 +110,8 @@ You can set these options in two ways: by passing arguments to the .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authSource="", authMechanism="SCRAM-SHA-1") @@ -120,7 +120,7 @@ You can set these options in two ways: by passing arguments to the .. code-block:: python - uri = ("mongodb://:" + uri = ("mongodb://:" "@:/?" "authSource=" "&authMechanism=SCRAM-SHA-1") diff --git a/source/security/enterprise-authentication.txt b/source/security/enterprise-authentication.txt index d14de7e8..230cf214 100644 --- a/source/security/enterprise-authentication.txt +++ b/source/security/enterprise-authentication.txt @@ -183,8 +183,8 @@ You can set this option in two ways: by passing an argument to the .. code-block:: python client = pymongo.MongoClient("mongodb://:", - username="", - password="", + username="", + password="", authMechanism="PLAIN", tls=True) @@ -193,7 +193,7 @@ You can set this option in two ways: by passing an argument to the .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "&authMechanism=PLAIN" "&tls=true") client = pymongo.MongoClient(uri) From 78ffc5f276437cd47a5fd141a51796503c24399e Mon Sep 17 00:00:00 2001 From: Jordan Smith Date: Mon, 12 Aug 2024 13:40:11 -0700 Subject: [PATCH 2/2] missed placeholders --- source/connect.txt | 2 +- source/includes/connect/client-cert-tabs.rst | 2 +- source/includes/connect/compression-tabs.rst | 4 ++-- source/includes/connect/disable-cert-validation-tabs.rst | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/connect.txt b/source/connect.txt index 1abda5a8..dc6c2609 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -252,7 +252,7 @@ timeoutMS Connection Option .. code-block:: python - uri = "mongodb://:@/?timeoutMS=" + uri = "mongodb://:@/?timeoutMS=" client = pymongo.MongoClient(uri) To learn more about client-side timeouts, see :ref:`pymongo-csot`. diff --git a/source/includes/connect/client-cert-tabs.rst b/source/includes/connect/client-cert-tabs.rst index 81fc4d37..60d2b922 100644 --- a/source/includes/connect/client-cert-tabs.rst +++ b/source/includes/connect/client-cert-tabs.rst @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@/?" + uri = ("mongodb://:@/?" "tls=true" "&tlsCertificateKeyFile=path/to/client.pem") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/compression-tabs.rst b/source/includes/connect/compression-tabs.rst index 98eb16f6..d4db3a23 100644 --- a/source/includes/connect/compression-tabs.rst +++ b/source/includes/connect/compression-tabs.rst @@ -5,7 +5,7 @@ .. code-block:: python - client = pymongo.MongoClient("mongodb://:@:", + client = pymongo.MongoClient("mongodb://:@:", compressors = "snappy,zstd,zlib") .. tab:: Connection String @@ -13,6 +13,6 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "compressors=snappy,zstd,zlib") client = pymongo.MongoClient(uri) \ No newline at end of file diff --git a/source/includes/connect/disable-cert-validation-tabs.rst b/source/includes/connect/disable-cert-validation-tabs.rst index 2a586d26..bae3c9a5 100644 --- a/source/includes/connect/disable-cert-validation-tabs.rst +++ b/source/includes/connect/disable-cert-validation-tabs.rst @@ -14,7 +14,7 @@ .. code-block:: python - uri = ("mongodb://:@:/?" + uri = ("mongodb://:@:/?" "tls=true" "&tlsAllowInvalidCertificates=true") client = pymongo.MongoClient(uri) \ No newline at end of file