Skip to content

Commit 831ec78

Browse files
authored
DOCSP-38345: session converted to struct (#359)
* DOCSP-38345: session converted to struct * MD tech review suggestions
1 parent 58e97ac commit 831ec78

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

source/fundamentals/transactions.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Methods
5858
-------
5959

6060
After you start a session by using the ``StartSession()`` method, you can modify
61-
the session state by using the method set provided by the ``Session`` interface. The
61+
the session state by using the method set provided by the returned ``Session``. The
6262
following table describes these methods:
6363

6464
.. list-table::
@@ -123,9 +123,9 @@ following table describes these methods:
123123
| **Parameter**: ``Context``
124124
| **Return Type**: none
125125

126-
The ``Session`` interface also has methods to retrieve session
127-
properties and modify mutable session properties. Find more information
128-
in the :ref:`API documentation <api-docs-transaction>`.
126+
A ``Session`` also has methods to retrieve session
127+
properties and modify mutable session properties. View the :ref:`API
128+
documentation <api-docs-transaction>` to learn more about these methods.
129129

130130
Example
131131
-------

source/includes/fundamentals/code-snippets/transaction.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func main() {
4343

4444
// Inserts multiple documents into a collection within a transaction,
4545
// then commits or ends the transaction
46-
result, err := session.WithTransaction(context.TODO(), func(ctx mongo.SessionContext) (interface{}, error) {
46+
result, err := session.WithTransaction(context.TODO(), func(ctx context.Context) (interface{}, error) {
4747
result, err := coll.InsertMany(ctx, []interface{}{
4848
bson.D{{"title", "The Bluest Eye"}, {"author", "Toni Morrison"}},
4949
bson.D{{"title", "Sula"}, {"author", "Toni Morrison"}},

source/whats-new.txt

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ The 2.0 {+driver-short+} release includes the following improvements and fixes:
7979

8080
To view sample event documents, see the :ref:`golang-monitoring` guides.
8181

82+
- The ``Session`` interface is converted to a struct. See the
83+
:ref:`golang-transactions` guide to learn more.
84+
8285
.. _version-1.15:
8386

8487
What's New in 1.15

0 commit comments

Comments
 (0)