Uploaded image for project: 'VS Code Extension'
  1. VS Code Extension
  2. VSCODE-351

Launch MongoDB Shell is not working for cmd and pwsh

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      node.js / npm versions: not relevant
      OS: Windows 10 21H2
    • 2

      Problem Statement/Rationale

      What is going wrong? What action would you like the Engineering team to take?
      Please be sure to attach relevant logs with any sensitive data redacted.

      The opening of a shell does not give the right commands to terminals, namely to cmd and pwsh, thus either failing or connecting to the wrong database.

      for cmd
      the issued command is mongo %MDB_CONNECTION_STRING%. the problem here is that if the connection string has & in it, it is considered as part of the terminal's "and then" logic, thus it does not work properly

      for pwsh
      the issued command is mongo $MDB_CONNECTION_STRING . the problem here is that this environment variable is empty for powershell, thus mongo shell tries to connect to localhost. actually, this works on Linux shells but is not how environment variables are accessed in powershell, suggesting this shell is not considered to be a powershell.

      for powershell version 5 and above, and for cygwin-bash

      environment variables are seemingly set and used correctly: mongo $Env:MDB_CONNECTION_STRING and mongo $MDB_CONNECTION_STRING respectively

      Steps to Reproduce

      How could an engineer replicate the issue you’re reporting?

      Expected Results

      What do you expect to happen?

      both cmd and pwsh connects to the right database succesfuly

      Actual Results

      What do you observe is happening?

      Additional Notes

      Any additional information that may be useful to include.

      Created from GitHub issue: https://github.com/mongodb-js/vscode/issues/430

            Assignee:
            gaurab.aryal@mongodb.com Gaurab Aryal
            Reporter:
            alena.khineika@mongodb.com Alena Khineika
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: