@@ -117,13 +117,30 @@ using the :option:`--norc <mongosh --norc>` option.
117117Terminate a Running Command
118118---------------------------
119119
120- To terminate a running command or query in `` mongosh` `,
120+ To terminate a running command or query in :binary:`~bin. mongosh`,
121121press ``Ctrl + C``.
122122
123- ``Ctrl + C`` terminates the process in the shell, but does not
124- terminate the process on the MongoDB server. This behavior
125- differs from the :method:`db.killOp()` method, which terminates
126- commands on the server.
123+ When you enter ``Ctrl + C``, :binary:`~bin.mongosh`:
124+
125+ - interrupts the active command,
126+ - tries to terminate the ongoing, server-side operation, and
127+ - returns a command prompt.
128+
129+ If :binary:`~bin.mongosh` cannot cleanly terminate the running process,
130+ it issues a warning.
131+
132+ .. note::
133+
134+ Pressing ``Ctrl + C`` in :binary:`~bin.mongosh` does not terminate
135+ asynchronous code. Asynchronous operations such as ``setTimeout`` or
136+ operations like ``fs.readFile`` continue to run.
137+
138+ There is no way to terminate asynchronous code in
139+ :binary:`~bin.mongosh`. This is the same behavior as in the Node.js
140+ `REPL <https://nodejs.org/api/repl.html>`__.
141+
142+ Pressing ``Ctrl + C`` once will not exit :binary:`~bin.mongosh`, press
143+ ``Ctrl + C`` twice to exit :binary:`~bin.mongosh`.
127144
128145Command Exceptions
129146------------------
@@ -150,3 +167,4 @@ with ``Ctrl + L`` and ``console.clear()``.
150167
151168 /crud
152169 /run-agg-pipelines
170+
0 commit comments