Skip to content

Commit ff56653

Browse files
committed
review comments
1 parent f1d1edc commit ff56653

File tree

1 file changed

+9
-108
lines changed

1 file changed

+9
-108
lines changed

source/connect/mongoclient.txt

Lines changed: 9 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To connect to a MongoDB deployment, you need two things:
2525
- A **connection URI**, also known as a *connection string*, which tells the {+driver-short+}
2626
which MongoDB deployment to connect to.
2727
- A **MongoClient** object, which creates the connection to and perform
28-
opertions on the MongoDB deployment.
28+
operations on the MongoDB deployment.
2929

3030
You can also use either of these components to customize the way the {+driver-short+} behaves
3131
while connected to MongoDB.
@@ -40,8 +40,6 @@ Connection URI
4040

4141
A standard connection string includes the following components:
4242

43-
.. Any ref for authentication? Are we planning on making a page for authentication?
44-
4543
.. list-table::
4644
:widths: 20 80
4745
:header-rows: 1
@@ -58,8 +56,9 @@ A standard connection string includes the following components:
5856

5957
- Optional. Authentication credentials. If you include these, the client
6058
authenticates the user against the database specified in ``authSource``.
61-
For more information about the ``authSource`` connection option, see
62-
:ref:`pymongo-auth`.
59+
60+
.. TODO, add this as last sentence for ``username:password``: For more information about the ``authSource`` connection option, see
61+
:ref:`kotlin-sync-auth`.
6362

6463
* - ``host[:port]``
6564

@@ -80,23 +79,21 @@ A standard connection string includes the following components:
8079
:ref:`kotlin-sync-connection-options` for a full description of
8180
these options.
8281

83-
.. Is there relevant connection string content for kotlin sync to ref to? Only see for java sync.
84-
8582
For more information about creating a connection string, see
8683
:manual:`Connection Strings </reference/connection-string?tck=docs_driver_kotlin>` in the
8784
MongoDB Server documentation.
8885

8986
Atlas Connection Example
9087
------------------------
9188

92-
To connect to a MongoDB deployment on Atlas, create a client. You can create a
93-
client that uses your connection string and other client options by passing a
89+
To connect to a MongoDB deployment on Atlas, you must first create a client.
90+
You can create a client with your desired configurations by passing a
9491
``MongoClientSettings`` object to the ``MongoClient.create()`` method.
9592

9693
To instantiate a ``MongoClientSettings`` object, use the builder method to
97-
specify your connection string and any other client options, and then call
98-
the ``build()`` method. Chain the ``applyConnectionString()``` method to the
99-
builder to specify your connection URI.
94+
specify your connection string, using the ``applyConnectionString()`` method,
95+
and any other client options. Once you have your desired configuration,
96+
call the ``build()`` method.
10097

10198
You can set the Stable API version client option to avoid breaking changes when
10299
you upgrade to a new server version. To learn more about the Stable API feature,
@@ -112,99 +109,3 @@ and verify that the connection is successful:
112109
:language: kotlin
113110
:copyable:
114111
:dedent:
115-
116-
Connect to a MongoDB Server or Replica Set
117-
------------------------------------------
118-
119-
If you are connecting to a single MongoDB server instance or a MongoDB
120-
replica set, see the following sections to find out how to connect.
121-
122-
.. _connect-local-kotlin-sync-driver:
123-
124-
Connect to a MongoDB Server on Your Local Machine
125-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126-
127-
If you need to run a MongoDB server on your local machine for development
128-
purposes instead of using an Atlas cluster, you need to complete the following:
129-
130-
1. Download the `Community <https://www.mongodb.com/try/download/community>`__
131-
or `Enterprise <https://www.mongodb.com/try/download/enterprise>`__ version
132-
of MongoDB Server.
133-
134-
#. :ref:`Install and configure <tutorials-installation>`
135-
MongoDB Server.
136-
137-
#. Start the server.
138-
139-
.. important::
140-
141-
Always secure your MongoDB server from malicious attacks. See our
142-
:manual:`Security Checklist </administration/security-checklist/>` for a
143-
list of security recommendations.
144-
145-
After you successfully start your MongoDB server, specify your connection
146-
string in your driver connection code.
147-
148-
If your MongoDB Server is running locally, you can use the connection string
149-
``"mongodb://localhost:<port>"`` where ``<port>`` is the port number you
150-
configured your server to listen for incoming connections. If the port number
151-
is not specified, the default port ``27017`` is used.
152-
153-
If you need to specify a different hostname or IP address, see our Server
154-
Manual entry on :manual:`Connection Strings </reference/connection-string/>`.
155-
156-
.. _connect-replica-set:
157-
158-
Connect to a MongoDB Replica Set
159-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160-
161-
A MongoDB replica set deployment is a group of connected instances that
162-
store the same set of data. This configuration of instances provides data
163-
redundancy and high data availability.
164-
165-
To connect to a replica set deployment, specify the hostnames (or IP
166-
addresses) and port numbers of the members of the replica set.
167-
168-
If you are not able to provide a full list of hosts in the replica set,
169-
you can specify a single or subset of the hosts in the replica and
170-
instruct the driver to perform automatic discovery in one of the following
171-
ways:
172-
173-
- Specify the name of the replica set as the value of the ``replicaSet``
174-
parameter
175-
- Specify ``false`` as the value of the ``directConnection`` parameter
176-
- Specify more than one host in the replica set
177-
178-
.. tip::
179-
180-
Although you can specify a subset of the hosts in a replica set,
181-
include all the hosts in the replica set to ensure the driver is able to
182-
establish the connection if one of the hosts are unreachable.
183-
184-
.. _mongo-client-settings-multiple-hosts:
185-
186-
The following examples show how to specify multiple hosts to a ``MongoClient``
187-
instance using either the ``ConnectionString`` or ``MongoClientSettings``
188-
class. Select the tab that corresponds to your preferred class.
189-
190-
.. tabs::
191-
192-
.. tab:: ConnectionString
193-
:tabid: connectionstring
194-
195-
.. literalinclude:: /includes/connect/mongoclient.kt
196-
:start-after: start-replica-set-connection-string
197-
:end-before: end-replica-set-connection-string
198-
:language: kotlin
199-
:copyable:
200-
:dedent:
201-
202-
.. tab:: MongoClientSettings
203-
:tabid: mongoclientsettings
204-
205-
.. literalinclude:: /includes/connect/mongoclient.kt
206-
:start-after: start-replica-set-client-settings
207-
:end-before: end-replica-set-client-settings
208-
:language: kotlin
209-
:copyable:
210-
:dedent:

0 commit comments

Comments
 (0)