Skip to content

Commit 0a579e3

Browse files
committed
RUBY-1271 Minor fixes to tutorial
1 parent 08e4ab3 commit 0a579e3

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

docs/tutorials/ruby-driver-create-client.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,4 @@ Most of the write methods you use day-to-day on a collection will be retryable i
552552
- ``collection#find_one_and_update``
553553
- ``collection#find_one_and_replace``
554554
- ``collection#find_one_and_delete``
555-
- ``collection#bulk_write`` # as long as there is no ``update_many`` or ``delete_many`` in the list of operations
555+
- ``collection#bulk_write`` # for all single statement ops (i.e. not for ``update_many`` or ``delete_many``)

docs/tutorials/ruby-driver-sessions.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ be aware that if the application calls ``#start_session`` on a client and waits
4141
the session, it risks getting errors due to the session going stale before it is used.
4242

4343

44-
4544
Using a session
4645
---------------
47-
A session can be passed to most operations performed via the driver so that the operation can be executed in the
46+
A session object can be passed to most driver methods so that the operation can be executed in the
4847
context of that session. Please see the API docs for which methods support a session argument.
4948

5049
Create a session and execute an insert, then a find using that session:
@@ -53,9 +52,9 @@ Create a session and execute an insert, then a find using that session:
5352

5453
session = client.start_session
5554
client[:artists].insert_one({ :name => 'FKA Twigs' }, session: session)
56-
client[:artists].find({ :name => 'FKA Twigs' }, session: session).first
55+
client[:artists].find({ :name => 'FKA Twigs' }, limit: 1, session: session).first
5756

58-
If you like to call methods on a ``Mongo::Collection::View`` that use a particular session, you can create the
57+
If you like to call methods on a ``Mongo::Collection::View`` in the context of a particular session, you can create the
5958
``Mongo::Collection::View`` with the session and then call methods on it:
6059

6160
.. code-block:: ruby
@@ -89,14 +88,14 @@ To create a causally consistent session, set the ``causal_consistency`` option t
8988
collection.update_one({ '_id' => 1 }, { '$set' => { 'x' => 0 } }, session: session)
9089

9190
# Read your write, even when reading from a secondary!
92-
collection.find({ '_id' => 1 }, limit: 1, session: session).first
91+
collection.find({ '_id' => 1 }, session: session).first
9392

9493
# This query returns data at least as new as the previous query,
9594
# even if it chooses a different secondary.
96-
collection.find({ '_id' => 2 }, limit: 1, session: session).first
95+
collection.find({ '_id' => 2 }, session: session).first
9796

9897
Since unacknowledged writes don't receive a response from the server (or don't wait for a response), the driver
99-
has no way of keeping track of where the unacknowledged write is in logical time. Therefore, be aware that causally
98+
has no way of keeping track of where the unacknowledged write is in logical time. Therefore, causally
10099
consistent reads are not causally consistent with unacknowledged writes.
101100

102101
Note that if you set the causal_consistency option to nil as in ``(causal_consistency: nil)``, it will be interpreted

0 commit comments

Comments
 (0)