MongoDB for VS Code
MongoDB for VS Code lets you easily work with MongoDB directly from your VS Code environment. Using the MongoDB extension, you can:
- Connect to a MongoDB instance or cluster
- Navigate your databases and collections
- Prototype queries and aggregations
You can install the MongoDB extension from inside of VS Code via the VS Code Extension Marketplace. Help us improve the MongoDB for VS Code by posting your ideas and suggestions for improvements.
14 results found
-
Integration of an Aggregation/Query Formater
Bad formatting of queries are a pain. Queries and specially Aggregation Pipelines can get quickly unreadable, unmaintaibable or miss understandable. To avoid this I'd like to ask for a code formater. There will be always a discussion of a good and better style, but at one point a suggestion is better than nothing. Here https://developer.mongodb.com/community/forums/t/what-are-some-of-the-biggest-mistakes-people-make-in-aggregation-pipelines/11803/4 you can find a brief discussion which triggered this request.
To get a kind of flexible the integration of a project wide config file might be interesting. The editorconfig https://editorconfig.org/ is supported by VSCode, simple text file, just check it with the code and it…20 votesWith MongoDB for VS Code 1.0, Playground files are now true JS files. This means that whatever configuration you normally use for code formatting (e.g. Standard, Prettier, etc.) is available also for Playgrounds.
-
Formatting support for mongodb playground files.
There's no way that I can find to format the code in a .mongodb playground file.
At present, I need to manually change the file suffix to js, then use a hot-key to run prettier, then rename it back.
If there is a better way, I'd love to know it!
Thanks,
Kim
19 votesWith MongoDB for VS Code 1.0, Playground files are now true JS files. This means that whatever configuration you normally use for code formatting (e.g. Standard, Prettier, etc.) is available also for Playgrounds.
-
Ability to delete individual records in a collection
Ability to delete individual records in a collection either using the "backspace" or the menu (delete record). Also, an "empty this collection" would help.
18 votesThank you for your feedback – we've added support for:
- Deleting any record in a collection by right clicking on a record and clicking 'Delete Document'
- Dropping Database or Collection with the right click context menu as well (https://www.mongodb.com/docs/mongodb-vscode/databases-collections/#drop-a-database-or-collection)
Ensure you've updated to the latest version of the extension if you don't see either of those options.
Please don't hesitate to reach out to me if you have any further feedback – I'd love to hear from you!
-
Write query with IntelliSense
The ability to write queries, with IntelliSense and see the results as JSON or Tables. The query language can be in MQL or SQL. The results can be exported as json, csv or excel.
16 votesMongoDB for VS Code 1.0 now includes autocomplete for the Query API. While we plan to making it even smarter in the future, in this version we introduced autocomplete for all the query and aggregation keywords.
-
Ability to edit connections
Ability to edit existing connections.
16 votesHi all, I'm excited to share that we just released a major revamp to our connections modal in VS Code. Notably:
- Added the ability to edit connections (https://www.mongodb.com/docs/mongodb-vscode/connect/#edit-a-connection)
- Added support for connecting with advanced connection settings – auth support for OIDC, LDAP, and AWS IAM; connection using TLS/SSL/SSH; ability to specify read preferences, and more (https://www.mongodb.com/docs/mongodb-vscode/connect/#enter-your-connection-information)
Please don't hesitate to reach out if you have any further feedback for us. We'd love to hear from you!
-
Write mode
It would be great to edit/delete database documents within the MongoDB VSCode extension, particularly when working with a test databases in Atlas.
I'm looking forward to seeing how this new extension will evolve.
15 votesThis has been released today.
Now, documents there are opened from the tree view, the collection view, and resulting from a find in a MongoDB Playground are editable and the changes are persisted in MongoDB.
-
Provide a option to execute individual queries
I don't see an option to execute the selected query. I was using Azure Cosmos DB extension from some time and that provides an option to execute a selected query.
7 votesThis has been released in version 0.1.0.
Select individual or multiple lines (even non-consecutive lines by using multiple cursors) and a code lens will appear that will allow you to run the selection. You can also use: “Run Selected Lines From Playground” in the command palette.
Let us know what you think!
-
shortcut key to execute queries
Executing the whole script or a selection with a shortcut key will be most useful.
6 votesThis is possible:
- Run All: Ctrl + Alt + r (Cmd + Alt + r on macOS)
- Run Selection: Ctrl + Alt + s (Cmd + Alt + s on macOS)
You can also customize the keybindings in your VS Code settings.
-
Aggregation Pipeline or MapReduce
Be able to create aggregation pipeline or MapReduce with IntelliSense.
4 votesMongoDB for VS Code 1.0 now includes autocomplete for the Query API. While we plan to making it even smarter in the future, in this version we introduced autocomplete for all the query and aggregation keywords.
-
3 votes
The collection in the tree view now has a refresh button next to Documents.
-
Export to Language
Allow to export to language within VSCode like what you have in compass.
2 votes -
A shortcut to run playground script. eg. F5.
It would be good if I can configure a shortcut to run the playground script instead of clicking the run button every time.
1 voteThe shortcut to run playgrounds is Ctrl/Cmd + Alt + R. You can also run selected playground blocks with Ctrl/Cmd + Alt + S. However, like with any shortcut in VS Code, you can customize these shortcuts from your VS Code settings.
-
Playground Output
When executing a query in playground, the results come in json format like when we click on a document in connections.
Currently {name: "value"}
Proposal {"name": "value"}1 voteIn the next release of the extension, results that are documents/JSON will be displayed in an editor view properly formatted and highlighted.
Here is the PR for reference: https://github.com/mongodb-js/vscode/pull/198
-
Add syntax checking for JS and JSON
The editor does not sense and redline JSON syntax errors. To work around this, I switch the file association to “JavaScript” whenever I am seriously editing a pipeline. Then I switch the file association back to “MongoDB” just before testing/executing the pipeline. This is inconvenient.
0 votesFrom v1.0.x on playgrounds are JS files so they will pickup any syntax and linting rules and use any tools that are configured for the project or from other extensions.
- Don't see your idea?