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.
11 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.
-
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.
-
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 -
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?