mongosh
functional
replacements for the native methods that were available in the legacy
mongo
shell. These methods are not exact replacements: output
formats and some functionality may differ from the corresponding
legacy methods.In addition to these methods, the mongocompat snippet
provides access to legacy mongo
shell APIs.
Note
In the following table <path>
and <filename>
are strings and
should be in quotes.
/ process.chdir( <path> ) process.chdir( "./data/incoming" )
Legacy Method Name | Replacement | ||
---|---|---|---|
| Returns the contents of the specified file
The legacy
| ||
| Returns the hostname of the system running
| ||
| Returns an array of documents that give the name and type of each object in the directory.
| ||
| |||
| Returns
| ||
| Returns a random number between
|