Skip to content

Commit 5725ed6

Browse files
(DOCSP-15026): Load method (#93)
* (DOCSP-15026): Load method * formatting fix * Wording tweak
1 parent e25b6a9 commit 5725ed6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/reference/methods.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,19 @@ Native Methods
837837

838838
- Description
839839

840+
* - :manual:`load() </reference/method/load/>`
841+
842+
- Loads and runs a JavaScript file in the shell.
843+
844+
In ``mongosh``, scripts loaded with the ``load()`` method support
845+
the ``__filename`` and ``__dirname`` Node.js variables. These
846+
variables return the file name and directory of the loaded
847+
script, respectively. The returned values are always absolute
848+
paths.
849+
850+
In the legacy shell, you cannot not access the script's file name
851+
or directory using the ``load()`` method.
852+
840853
* - ``print()``
841854

842855
- Print the specified text or variable. ``print()`` and ``printjson()``

0 commit comments

Comments
 (0)