microsoft / vscode-cosmosdb

Azure Databases extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb
MIT License
155 stars 69 forks source link

vCore: adds support for connecting to MongoDB Clusters with a connection string #2395

Closed tnaum-ms closed 1 week ago

tnaum-ms commented 2 weeks ago

This PR introduces support for "MongoDB Cluster Accounts" in the Workspace area. It provides an option to add a MongoDB cluster connection string to the workspace, store it, and use it to interact with a MongoDB cluster account. This feature is not exclusive to Azure domains and allows interaction with any MongoDB cluster.

image

Workspace Tree View

It is built on the v2 tree view API provided by azure-resources. This PR introduces SharedWorkspaceResourceProvider and SharedWorkspaceStorage for future use, enabling MongoDB Clusters support through MongoClustersWorkspaceBranchDataProvider and MongoDBAccountsWorkspaceItem

Behavior When Connecting to MongoDB Clusters

A new node has been added to the workspace tree view, allowing users to add new connections. There is no limit to the number of accounts that can be added:

image

When a user attempts to add a connection:

image

The connection string is verified, and any errors are shown. Users are then prompted to confirm the username and re-enter the password. If the user is confident that the password in the connection string is correct, they can confirm by pressing Enter.

image

image

Behavior When Connecting to Azure Cosmos DB for MongoDB (RU)

The connection flow begins similarly to MongoDB Clusters. However, if an RU cluster is detected (by checking the domain name suffix), the following actions occur:

If an RU connection string is detected:

  1. The user is informed:

image

  1. The connection is added to the "Attached Database Account" section, with focus set to the newly added node:

image

Other Changes

Most changes in the mongoClusters folder support the display of MongoDB cluster tree items within the workspace area.

sevoku commented 2 weeks ago

EDIT: nvm, it was a VPN error I ran into

sevoku commented 2 weeks ago

Also using the "Azure Databses"

image

Button works fine for NoSQL and MongoDB RU accounts, howerver it fails when I use Clusters Accounts > New Connection with an RU account

image

it asks for username and password which is not appiclable and fails at the end.

tnaum-ms commented 1 week ago

But this is minor, we should probably add the same behaviour with a message and add the Cluster to the appropriate section. So basically the opposite behavior to adding RU to Clusters section.

Indeed. I'll look into it in a separate PR once that build is out.

tnaum-ms commented 1 week ago

Thank you for your review and the hints. Merging.