Skip to content

Commit 2a498b5

Browse files
committed
update examples
1 parent 8771d58 commit 2a498b5

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

source/includes/run-command.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import org.bson.Document
33

44
fun main() {
55
//start-execute
6-
val command = {
7-
find: "restaurants",
8-
filter: { cuisine: "Italian" },
9-
projection: { name: 1, rating: 1, address: 1 },
10-
sort: { name: 1 },
11-
limit: 5
12-
}
13-
val commandResult = database.runCommand(command)
6+
val explanation = database.runCommand({
7+
explain: {
8+
find: 'restaurants'
9+
}
10+
})
1411
//end-execute
1512

1613
//start-read-preference

source/run-command.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ To run a database command, specify the command and any relevant
3737
parameters in a document, then pass the document to the ``runCommand()`` method.
3838

3939
The following code shows how you can use the ``runCommand()``
40-
method to run the ``find`` command, which returns information about
41-
the current member's role in the replica set, on a database:
40+
method to run the ``explain`` command, which returns information about
41+
how the specified CRUD command would be executed:
4242

4343
.. literalinclude:: /includes/run-command.kt
4444
:start-after: start-execute
@@ -155,9 +155,10 @@ Additional Information
155155

156156
For more information about the concepts in this guide, see the following documentation:
157157

158-
- Kotlin API
158+
- Kotlin Sync API
159159
- `runCommand() <{+api+}/com.mongodb.kotlin.client/-mongo-database/run-command.html>`__
160160
- Database
161161
- :manual:`Database Commands </reference/command/>`
162+
- :manual:`explain Command </reference/command/explain/>`
162163
- :manual:`hello Command </reference/command/hello/>`
163-
- :manual:`find Command </reference/command/find/>`
164+
- :manual:`buildInfo Command </reference/command/buildInfo/#mongodb-dbcommand-dbcmd.buildInfo>`

0 commit comments

Comments
 (0)