Skip to content

Commit ad7ec5c

Browse files
authored
Final v1 cleanup (#56)
1 parent 7b057cf commit ad7ec5c

File tree

10 files changed

+57
-58
lines changed

10 files changed

+57
-58
lines changed

source/connection-troubleshooting.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ are in the correct format.
129129
must `percent encode <https://tools.ietf.org/html/rfc3986#section-2.1>`__ it:
130130

131131
.. code-block:: none
132+
:copyable: false
132133

133134
: / ? # [ ] @
134135

source/fundamentals/authentication.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ in the options of your connection string or in a ``Credential`` struct.
4040
In this guide, the examples demonstrate how to configure
4141
authentication in a ``Credential`` struct.
4242

43-
..
44-
To learn more about the connection string options for authentication,
45-
see the :manual:`Authentication Options
46-
</reference/connection-string/#authentication-options>` section
47-
of the Connection String URI Format guide in the Server manual.
43+
To learn more about the connection string options for authentication,
44+
see the :manual:`Authentication Options
45+
</reference/connection-string/#authentication-options>` section
46+
of the Connection String URI Format guide in the Server manual.
4847

4948
.. _rust-auth-scram-mechanisms:
5049

source/fundamentals/connections/connection-options.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ connected to the server.
225225
a value of ``9`` specifies maximum compression.
226226
| To learn more about network compression, see the :ref:`rust-network-compression` guide.
227227

228-
..
229-
To see a full list of connection options, visit the :manual:`Connection String
230-
Options section </reference/connection-string/#connection-string-options>` of the
231-
Server manual entry on Connection Strings.
228+
To see a full list of connection options, visit the
229+
:manual:`Connection String Options section
230+
</reference/connection-string/#connection-string-options>` of the
231+
Server manual entry on Connection Strings.

source/fundamentals/enterprise-auth.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ To learn more about the concepts in this guide, see the following documentation:
109109
- :manual:`MongoDB Server Support for LDAP Proxy Authentication
110110
</core/security-ldap/>` in the Server manual
111111
- :ref:`rust-connection-options` guide
112-
113-
.. - :manual:`Connection Strings </reference/connection-string>`
112+
- :manual:`Connection Strings </reference/connection-string>` in the
113+
Server manual
114114

115115
API Documentation
116116
~~~~~~~~~~~~~~~~~

source/fundamentals/performance.txt

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,41 @@ Performance Considerations
1313
Overview
1414
--------
1515

16-
In this guide, you can learn how to optimize performance of the {+driver-short+}.
17-
To connect to MongoDB, you must create a ``Client`` instance. Your ``Client``
18-
instance automatically handles most aspects of connection, such as discovering server topology, monitoring
19-
your connection, and maintaining an internal connection pool.
20-
This guide describes best practices to configure and use your ``Client`` instance.
16+
In this guide, you can learn how to optimize the performance of the
17+
{+driver-short+}. To connect to MongoDB, you must create a ``Client`` instance. Your ``Client``
18+
instance automatically handles most aspects of connection, such as
19+
discovering server topology, monitoring your connection, and maintaining
20+
an internal connection pool. This guide describes best practices for
21+
configuring and using your ``Client`` instance.
2122

2223
.. _rust-performance-client-lifecycle:
2324

2425
Client Lifecycle
2526
----------------
2627

2728
We recommend that you reuse your client across sessions and operations.
28-
You can use the same ``Client`` instance to perform multiple tasks, as the ``Client`` type is safe for concurrent use by multiple threads.
29-
Creating a new ``Client`` instance for each request results in slower performance.
29+
You can use the same ``Client`` instance to perform multiple tasks, as
30+
the ``Client`` type is safe for concurrent use by multiple threads.
31+
Creating a new ``Client`` instance for each request results in slower
32+
performance.
3033

31-
The following code creates a method that accepts a pointer to an existing ``Client`` instance,
32-
which allows you to execute many requests by using same client:
34+
The following code creates a method that accepts a pointer to an
35+
existing ``Client`` instance, which allows you to perform many requests
36+
by using the same client:
3337

3438
.. literalinclude:: /includes/fundamentals/code-snippets/performance.rs
3539
:language: rust
3640
:dedent:
37-
:start-after: start-perf-client-faster
38-
:end-before: end-perf-client-faster
3941

4042
.. _rust-performance-parallelism:
4143

4244
Parallelism
4345
-----------
4446

45-
If you can run parallel data operations, you can optimize performance by running asynchronous, concurrent tasks.
46-
The following code uses the ``task`` module from the ``tokio`` crate to create separate, concurrent
47-
tasks for multiple data operations:
47+
If you can run parallel data operations, you can optimize performance by
48+
running asynchronous, concurrent tasks. The following code uses the
49+
``spawn()`` method from the ``tokio::task`` module to create separate,
50+
concurrent tasks to perform insert operations:
4851

4952
.. literalinclude:: /includes/fundamentals/code-snippets/performance-parallel.rs
5053
:language: rust
@@ -55,28 +58,31 @@ tasks for multiple data operations:
5558
Runtime
5659
-------
5760

58-
A ``Client`` instance is bound to the instance of the ``tokio`` or ``async-std`` runtime in which you created it.
59-
If you use a ``Client`` instance to perform operations on a different runtime, you might experience unexpected behavior or failures.
61+
A ``Client`` instance is bound to the instance of the ``tokio`` or
62+
``async-std`` runtime in which you created it. If you use a ``Client``
63+
instance to perform operations on a different runtime, you might
64+
experience unexpected behavior or failures.
6065

61-
If you are using the ``test`` helper macro from the ``tokio`` or ``async_std`` crate to test your application,
62-
you might accidentally run operations on a different runtime than you intended.
63-
This is because these helper macros create a new runtime for each test.
64-
You can use one of the following strategies to avoid this issue:
66+
If use the ``test`` helper macro from the ``tokio`` or
67+
``async_std`` crate to test your application, you might accidentally run
68+
operations on a different runtime than intended. This is because these
69+
helper macros create a new runtime for each test. However, you can use
70+
one of the following strategies to avoid this issue:
6571

6672
- Attach the runtime to the ``Client`` instance without using the ``test`` helper macros.
6773
- Create a new ``Client`` instance for every ``async`` test.
6874

6975
This example follows the first strategy and creates a global runtime used only for testing.
70-
In the following code, the ``test_list_dbs()`` method uses a client that manually connects to this runtime
71-
to list databases in the deployment.
76+
In the following code, the ``test_list_dbs()`` method uses a client that
77+
manually connects to this runtime to list databases in the deployment:
7278

7379
.. literalinclude:: /includes/fundamentals/code-snippets/performance-bundle-runtime.rs
7480
:language: rust
7581
:dedent:
7682

77-
Implementing the second strategy,
78-
the following code creates a new ``Client`` instance for each test run with ``tokio::test``,
79-
ensuring that there is no unintended interaction between runtimes:
83+
Implementing the second strategy, the following code creates a new
84+
``Client`` instance for each test run with ``tokio::test``,
85+
ensuring that there are no unintended interactions between runtimes:
8086

8187
.. literalinclude:: /includes/fundamentals/code-snippets/performance-new-client.rs
8288
:language: rust
@@ -85,13 +91,15 @@ ensuring that there is no unintended interaction between runtimes:
8591
Additional Information
8692
----------------------
8793

88-
For more information about the concepts in this guide, see the following pages:
94+
For more information about connecting to MongoDB, see the
95+
:ref:`Connection Guide <rust-connect-to-mongodb-client>`.
8996

90-
- :ref:`Connection Guide <rust-connect-to-mongodb-client>`
97+
.. TODO link to runtimes page
9198

9299
API Documentation
93100
~~~~~~~~~~~~~~~~~
94101

95102
- `Client() <{+api+}/struct.Client.html>`__
96-
97-
.. TODO link to Async page when done
103+
- `spawn() <https://docs.rs/tokio/latest/tokio/task/fn.spawn.html>`__ in
104+
the ``tokio::task`` module
105+
- `tokio::runtime <https://docs.rs/tokio/latest/tokio/runtime/index.html>`__ module

source/fundamentals/run-command.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Response
9393
--------
9494

9595
The ``run_command()`` method returns a ``Document`` instance that contains
96-
the response from the database after the command has been executed. Each
96+
the response from the database after the command runs. Each
9797
database command performs a different function, so the response content
9898
can vary across commands. However, every response contains a document
9999
with the following fields:

source/fundamentals/schema-validation.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Example
100100
This example creates a collection called ``survey_answers`` with the
101101
following validation specifications:
102102

103-
- The ``validator()`` method recieves a JSON schema specifying that the
103+
- The ``validator()`` method receives a JSON schema specifying that the
104104
``answer`` field in each document must have a value of ``"yes"`` or
105105
``"no"``.
106106
- The ``validation_action()`` method specifies whether the driver raises an
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
let client = Client::with_uri_str("<connection string>").await?;
2-
let some_data = doc! { "title": "1984", "author": "George Orwell" };
2+
let data = doc! { "title": "1984", "author": "George Orwell" };
33

44
for i in 0..5 {
55
let client_ref = client.clone();
6-
let somedata_ref = some_data.clone();
6+
let data_ref = data.clone();
77

88
task::spawn(async move {
99
let collection = client_ref
1010
.database("items")
1111
.collection::<Document>(&format!("coll{}", i));
1212

13-
collection.insert_one(somedata_ref, None).await
13+
collection.insert_one(data_ref, None).await
1414
});
1515
}
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1+
// ... Create a client earlier in your code
12

2-
// start-perf-client-slow
3-
async fn handle_request() -> Result<(), Box<dyn Error>> {
4-
let client = Client::with_uri_str("<connection string>").await?;
5-
// Do something with the client
3+
async fn make_request(client: &Client) -> Result<(), Box<dyn Error>> {
4+
// Use the client to perform operations
65
Ok(())
76
}
8-
// end-perf-client-slow
9-
10-
// start-perf-client-faster
11-
async fn handle_request(client: &Client) -> Result<(), Box<dyn Error>> {
12-
// Do something with the client
13-
Ok(())
14-
}
15-
// end-perf-client-faster

source/issues-and-help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To learn more, refer to the `support channels
1515
Bugs / Feature Requests
1616
-----------------------
1717

18-
If you think you've found a bug or want to request a new feature in the
18+
If you think you found a bug or want to request a new feature in the
1919
{+driver-short+}, please open a case in MongoDB's issue management tool,
2020
JIRA, by performing the following steps:
2121

0 commit comments

Comments
 (0)