-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:buildInfo()
{
version: '2.5.0',
distributionKind: 'compiled',
buildArch: 'x64',
buildPlatform: 'linux',
buildTarget: 'linux-x64-openssl3',
buildTime: '2025-04-08T13:07:57.160Z',
gitVersion: '2b03591a8cde3171c86f11d4217352266f1b1a9c',
nodeVersion: 'v20.19.0',
opensslVersion: '3.2.4',
sharedOpenssl: true,
runtimeArch: 'x64',
runtimePlatform: 'linux',
runtimeGlibcVersion: '2.40',
deps: {
nodeDriverVersion: '6.14.2',
libmongocryptVersion: '1.13.0',
libmongocryptNodeBindingsVersion: '6.3.0',
kerberosVersion: '2.1.0'
}
}buildInfo() { version: '2.5.0', distributionKind: 'compiled', buildArch: 'x64', buildPlatform: 'linux', buildTarget: 'linux-x64-openssl3', buildTime: '2025-04-08T13:07:57.160Z', gitVersion: '2b03591a8cde3171c86f11d4217352266f1b1a9c', nodeVersion: 'v20.19.0', opensslVersion: '3.2.4', sharedOpenssl: true, runtimeArch: 'x64', runtimePlatform: 'linux', runtimeGlibcVersion: '2.40', deps: { nodeDriverVersion: '6.14.2', libmongocryptVersion: '1.13.0', libmongocryptNodeBindingsVersion: '6.3.0', kerberosVersion: '2.1.0' } }
-
Not Needed
-
-
Developer Tools
Problem Statement/Rationale
MongoDB shell native methods documentation contains a list of available native methods in mongosh. Among them, there are:
- cd() - Changes the current working directory to the specified path.
- pwd() - Returns the current working directory of the active shell session.
If you try running one of the above methods, the shell will throw an error.
test> pwd() ReferenceError: pwd is not defined (Are you trying to run a script written for the legacy shell? Try running `snippet install mongocompat`) test> cd() ReferenceError: cd is not defined (Are you trying to run a script written for the legacy shell? Try running `snippet install mongocompat`)
Other commands work as expected (e.g. version() and print()).
Moreover, the above methods seems to not be available in mongosh related source code: https://github.com/mongodb-js/mongosh/blob/main/packages/shell-api/src/shell-api.ts
Steps to Reproduce
- open the shell
- run pwd()
- run cd()
Expected Results
Being able to change the working directory and printing the current one or remove them from the documentation.