From 2a498b501b6b5b57decd38d1e817f05ab012bf4c Mon Sep 17 00:00:00 2001 From: Rachel Mackintosh Date: Mon, 27 Jan 2025 11:46:56 -0500 Subject: [PATCH] update examples --- source/includes/run-command.kt | 13 +++++-------- source/run-command.txt | 9 +++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/source/includes/run-command.kt b/source/includes/run-command.kt index 3a63357..5708e69 100644 --- a/source/includes/run-command.kt +++ b/source/includes/run-command.kt @@ -3,14 +3,11 @@ import org.bson.Document fun main() { //start-execute - val command = { - find: "restaurants", - filter: { cuisine: "Italian" }, - projection: { name: 1, rating: 1, address: 1 }, - sort: { name: 1 }, - limit: 5 - } - val commandResult = database.runCommand(command) + val explanation = database.runCommand({ + explain: { + find: 'restaurants' + } + }) //end-execute //start-read-preference diff --git a/source/run-command.txt b/source/run-command.txt index 9cbf727..9f8a0fe 100644 --- a/source/run-command.txt +++ b/source/run-command.txt @@ -37,8 +37,8 @@ To run a database command, specify the command and any relevant parameters in a document, then pass the document to the ``runCommand()`` method. The following code shows how you can use the ``runCommand()`` -method to run the ``find`` command, which returns information about -the current member's role in the replica set, on a database: +method to run the ``explain`` command, which returns information about +how the specified CRUD command would be executed: .. literalinclude:: /includes/run-command.kt :start-after: start-execute @@ -155,9 +155,10 @@ Additional Information For more information about the concepts in this guide, see the following documentation: -- Kotlin API +- Kotlin Sync API - `runCommand() <{+api+}/com.mongodb.kotlin.client/-mongo-database/run-command.html>`__ - Database - :manual:`Database Commands ` + - :manual:`explain Command ` - :manual:`hello Command ` - - :manual:`find Command ` + - :manual:`buildInfo Command `