Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions source/includes/write/transaction.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.mongodb.*
import com.mongodb.client.ClientSession
import com.mongodb.client.MongoClients
import com.mongodb.kotlin.client.ClientSession
import com.mongodb.kotlin.client.MongoClient
import org.bson.Document

// start-data-class
Expand All @@ -10,7 +9,7 @@ data class Restaurant(val name: String, val cuisine: String)
fun main() {
// start-transaction
// Creates a new MongoClient to manage your connection
val client = MongoClients.create("<connection string>")
val client = MongoClient.create("<connection string>")

// Gets the database and collection
val database = client.getDatabase("sample_restaurants")
Expand Down
2 changes: 1 addition & 1 deletion source/write/transactions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ through the following steps:
#. Define the ``insertRestaurantsInTransaction()`` method to insert multiple
documents into the ``restaurants`` collection.
#. Use the ``withTransaction()`` method to start a transaction. The ``withTransaction()``
method runs the insert operation and commits the transaction. If any
method runs the insert operations and commits the transaction. If any
operation results in errors, ``withTransaction()`` cancels the transaction.
#. Close the connection to the server by using the ``MongoClient.close()`` method.

Expand Down
Loading