pwd() and cd() native methods not available in mongo shell

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
    • Not Needed
    • Hide

      We are currently updating our docs to remove these. TBD when the docs changes are live.

      Show
      We are currently updating our docs to remove these. TBD when the docs changes are live.
    • 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.

            Assignee:
            Unassigned
            Reporter:
            Alessandro Miliucci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: