Feature Request: Allow saving connection to settings.json #368

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.12.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Iteration Satellite, Iteration Telescope
    • Needed
    • Hide

      Adds option to specify mdb.presetConfigurations inside settings.json (likely for a workspace) which will load a preset list of connections based on that. This setting defines preset connections. It can be used to share connection configurations in a workspace or global scope.

      It is important that users do not store sensitive credentials here as it is just saved as a plaintext file and is easily accessible. The common usecase where this setting is useful is if for example some project has a local mongodb instance associated with it for tests and the repository owner wants to share different preset connection settings for when one loads this.

      The setting format is an array of preset connections defined with this kind of schema: 

                   "name":

      {                 "type": "string",                 "description": "Name of the connection."               }

      ,
                    "connectionString":

      {                 "type": "string",                 "description": "Connection string. Do not store sensitive credentials here."               }

                  },

      Users can discover this by clicking the ... in the Tree View next to the Plus icon and selecting Edit Preset Connections... which will open the relevant file as it is detected (or create a preset connection in the workspace to modify if one doesn't exist already).

      Preset connections can only be edited through the settings.json file they originate from which can also be accessed when right clicking the a preset connection and choosing "Edit Preset Connections..."

      See also: https://github.com/mongodb-js/vscode/pull/909

       

      Show
      Adds option to specify mdb.presetConfigurations inside settings.json (likely for a workspace) which will load a preset list of connections based on that. This setting defines preset connections. It can be used to share connection configurations in a workspace or global scope. It is important that users do not store sensitive credentials here as it is just saved as a plaintext file and is easily accessible. The common usecase where this setting is useful is if for example some project has a local mongodb instance associated with it for tests and the repository owner wants to share different preset connection settings for when one loads this. The setting format is an array of preset connections defined with this kind of schema:               "name": {                 "type": "string",                 "description": "Name of the connection."               } ,               "connectionString": {                 "type": "string",                 "description": "Connection string. Do not store sensitive credentials here."               }             }, Users can discover this by clicking the ... in the Tree View next to the Plus icon and selecting Edit Preset Connections... which will open the relevant file as it is detected (or create a preset connection in the workspace to modify if one doesn't exist already). Preset connections can only be edited through the settings.json file they originate from which can also be accessed when right clicking the a preset connection and choosing "Edit Preset Connections..." See also: https://github.com/mongodb-js/vscode/pull/909  
    • Developer Tools

      Copy from https://github.com/mongodb-js/vscode/issues/368 

      Feature Request

      Ability to save connections into settings.json within the opened folder context (i.e. .vscode/settings.json) or within the devcontainer context (i.e. .devcontainer/devcontainer.json under the key "settings")

      Context

      Especially useful when combining VS Code remote containers and docker compose to startup the mongodb container within the workspace and have it automatically configured to be connected to the container within this setup.

      As an example of how the MSSQL extension does it and then this can be added to .devcontainer/devcontainer.json
      "mssql.connections": [
      { "server": "put-server-name-here", "database": "put-database-name-here", "user": "put-username-here", "password": "put-password-here" }
      ]
       
      See dotnet-mssql remote container template https://github.com/microsoft/vscode-dev-containers/tree/main/containers/dotnet-mssql for how they utilise remote containers and the mssql container for a great dev environment setup. Looking at a similar scenario with any language + mongodb as the data store

      Possible Implementation

      settings.json
      "mdb.connections": [

      { "name": "connection name", "connectionString": "mongodb://user:password@server/database" }

      ]

            Assignee:
            Gagik Amaryan
            Reporter:
            Gaurab Aryal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: