• Stars
    star
    318
  • Rank 131,872 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Connect to MongoDB and Atlas and directly from your VS Code environment, navigate your databases and collections, inspect your schema and use playgrounds to prototype queries and aggregations.

MongoDB for VS Code

Build Status

MongoDB for VS Code makes it easy to work with your data in MongoDB directly from your VS Code environment. MongoDB for VS Code is the perfect companion for MongoDB Atlas, but you can also use it with your self-managed MongoDB instances.

MongoDB for VS Code demo video call to action

Features

Navigate your MongoDB Data

  • Navigate your databases, collections, and read-only views
  • See the documents in your collections
  • Edit documents and save changes to the database
  • Get a quick overview of your schema and your indexes

Read more about this functionality in the online documentation.

Explore data with MongoDB for VS Code

MongoDB Playgrounds

MongoDB Playgrounds are the most convenient way to prototype and execute CRUD operations and other MongoDB commands directly inside VS Code.

  • Prototype your queries, aggregations, and MongoDB commands with convenient syntax highlighting and intelligent autocomplete for MongoDB Shell API, BSON types, MongoDB Query API, system variables, and for database, collection, and field names.
  • Run your playgrounds and see the results instantly. Click the play button in the tab bar to see the output.
  • Edit documents returned by your playground.
  • Save your playground together with your application code to always have a place where all your queries are documented and can be tested just with one click.

Playgrounds

Note: Make sure you are connected to a server or cluster before using a playground. You can't run a playground and you won't get intelligent completions if you are not connected.

From Query API to your favorite language

Select queries and aggregations within your Playground files and translate them into your favorite programming language. Supported languages are:

  • Java
  • Node.js
  • C#
  • Python 3
  • Ruby

Export to language

Document Editing

Editing documents with MongoDB for VS Code is as natural as editing any file in the code editor. Open a document in an editor tab, edit it, and save the changes back to MongoDB.

Document editing

Quick access to the MongoDB Shell

Launch the MongoDB Shell from the command palette to quickly connect to the same cluster you have active in VS Code.

MongoDB Shell

Note: The mongosh binary needs to be in your $PATH. You can download the mongosh from the MongoDB Download Center.

Terraform snippet for MongoDB Atlas

If you use Terraform to manage your infrastructure, MongoDB for VS Code helps you get started with the MongoDB Atlas Provider. Just open a Terraform file, type atlas and you are good to go.

Terraform snippet

Extension Settings

Setting Description Default
mdb.shell The MongoDB shell to use ( mongosh or the legacy mongo ). mongosh
mdb.showMongoDBConnectionExplorer Show or hide the MongoDB Connection explorer. true
mdb.showMongoDBPlaygrounds Show or hide the MongoDB Playgrounds explorer. true
mdb.showMongoDBHelpExplorer Show or hide the MongoDB Help panel. true
mdb.defaultLimit The number of documents to fetch when viewing documents from a collection. 10
mdb.confirmRunAll Show a confirmation message before running commands in a playground. true
mdb.confirmDeleteDocument Show a confirmation message before deleting a document in the tree view. true
mdb.excludeFromPlaygroundsSearch Exclude files and folders while searching for playground files in the current workspace. Refer to package.json
mdb.connectionSaving. hideOptionToChooseWhereToSaveNewConnections When a connection is added, a prompt is shown that let's the user decide where the new connection should be saved. When this setting is checked, the prompt is not shown and the default connection saving location setting is used. true
mdb.connectionSaving. defaultConnectionSavingLocation When the setting that hides the option to choose where to save new connections is checked, this setting sets if and where new connections are saved. Global
mdb.useDefaultTemplateForPlayground Choose whether to use the default template for playground files or to start with an empty playground editor. true
mdb.uniqueObjectIdPerCursor The default behavior is to generate a single ObjectId and insert it on all cursors. Set to true to generate a unique ObjectId per cursor instead. false
mdb.sendTelemetry Opt-in and opt-out for diagnostic and telemetry collection. true

Additional Settings

Autocomplete

Note: these global settings affect how MongoDB for VS Code provides intelligent autocomplete inside snippets and string literals (off by default). Changing the default configuration may affect the behavior and performance of other extensions and of VS Code itself. If you do not change the default settings, you can still trigger intelligent autocomplete inside a snippet or string literal with Ctrl+Space.

  • editor.suggest.snippetsPreventQuickSuggestions: By default, VS Code prevents code completion in snippet mode (editing placeholders in inserted code). Setting this to false allows snippet (eg. $match, $addFields) and field completion based on the document schema for the db.collection.aggregate() expressions.
  • editor.quickSuggestions: By default, VS Code prevents code completion inside string literals. To enable database names completions for use('dbName') expression use this configuration:
"editor.quickSuggestions": {
  "other": true,
  "comments": false,
  "strings": true
}

Syntax Highlighting

MongoDB playgrounds are JavaScript files, which causes JavaScript syntax highlighting to override any customizations made to the MongoDB syntax colors.

Currently, there is no way to resolve this except for turning off semantic highlighting for a current workspace, or for all themes that are being used by setting editor.semanticHighlighting.enabled to false.

Telemetry

MongoDB for VS Code collects usage data and sends it to MongoDB to help improve our products and services. Read our privacy policy to learn more. If you don’t wish to send usage data to MongoDB, you can opt-out by setting mdb.sendTelemetry to false in the extension settings.

Contributing

For issues, please create a ticket in our JIRA Project.

For contributing, please refer to CONTRIBUTING.md.

Is there anything else you’d like to see in MongoDB for VS Code? Let us know by submitting suggestions in our feedback forum.

Building and Installing from Source

You can clone this repository and install the extension in your VS Code with:

npm install
npm run local-install

This will compile and package MongoDB for VS Code into a .vsix file and add the extension to your VS Code.

To install this locally on Windows:

npm install
.\node_modules\.bin\vsce.cmd package
code --install-extension ./mongodb-vscode-*.vsix

This will compile and package MongoDB for VS Code into a .vsix file and add the extension to your VS Code.

If you get an error because the code command is not found, you need to install it in your $PATH.

Open VS Code, launch the Command Palette (⌘+Shift+P on macOS, Ctrl+Shift+P on Windows and Linux), type code and select "Install code command in $PATH".

License

Apache 2.0

More Repositories

1

compass

The GUI for MongoDB.
TypeScript
913
star
2

boxednode

πŸ“¦ boxednode – Ship a JS file with Node.js in a box
TypeScript
603
star
3

mongosh

The MongoDB Shell
TypeScript
323
star
4

mongoose-autopopulate

Always populate() certain fields in your mongoose schemas
JavaScript
211
star
5

electron-squirrel-startup

Default Squirrel.Windows event handler for your Electron apps.
JavaScript
204
star
6

mongodb-core

MongoDB core driver functionality aims to make the "smallest" viable driver api
JavaScript
191
star
7

connect-mongodb-session

Lightweight MongoDB-backed session store for Connect and Express
JavaScript
169
star
8

kerberos

Kerberos library for node.js
C++
169
star
9

mongodb-schema

Infer a probabilistic schema for a MongoDB collection.
TypeScript
122
star
10

runner

Start all mongodb deployment types for testing
JavaScript
89
star
11

mongodb-prebuilt

Install MongoDB prebuilt package using npm https://npmjs.org/package/mongodb-prebuilt
TypeScript
57
star
12

bson-transpilers

Metatranspiler for the export to language / language modes Compass feature.
JavaScript
52
star
13

version-manager

Cross-platform helper for managing multiple versions of MongoDB
JavaScript
46
star
14

zstd

A Zstd Compression Library
JavaScript
44
star
15

bson-ext

The C++ bson parser for the node.js mongodb driver.
JavaScript
43
star
16

mongodb-topology-manager

Localhost MongoDB Topology Management API
JavaScript
43
star
17

charts-embed-sdk

The easiest way to embed MongoDB Charts visualisations into your web app
43
star
18

extended-json

On spec MongoDB Extended JSON parse and stringify
JavaScript
37
star
19

query-parser

Safe parsing and validation for MongoDB queries (filters), projections, and more.
TypeScript
36
star
20

jsonpatch-to-mongodb

Convert JSON patches into a MongoDB update
JavaScript
34
star
21

mongodb-language-model

Parses MongoDB query language and creates hierarchical Ampersand.js models to interact with the query tree
JavaScript
34
star
22

dataset-generator

🚧 What's a database without any data?
JavaScript
33
star
23

connect-backbone-to-react

Connect Backbone Models and Collections to React.
JavaScript
27
star
24

pretty-repl

Extends Node's repl.REPLServer to allow for a colorize function.
JavaScript
24
star
25

mongodb-extjson

MongoDB Extended JSON library
JavaScript
21
star
26

electron-license

Tools for electron apps to work with licenses.
JavaScript
18
star
27

devtools-shared

Shared dependencies of Compass, the MongoDB extension for VSCode and mongosh
TypeScript
14
star
28

log

🚧 Parse MongoDB log lines into objects
JavaScript
13
star
29

mongodb-download

JavaScript
12
star
30

mongo-views

Virtual collections - aka views with joins - in the MongoDB shell.
JavaScript
11
star
31

electron-installer-codesign

Sign your electron apps on OSX.
JavaScript
11
star
32

collection-sample

Sample documents from MongoDB collections.
JavaScript
11
star
33

mongodb-connection-string-url

MongoDB connection strings, based on the WhatWG URL API
TypeScript
10
star
34

node-codesign

Sign Node.js apps for MacOS.
JavaScript
10
star
35

connection-model

MongoDB connection model.
JavaScript
10
star
36

mongodb-js

Discussion, community, and best practices
8
star
37

mongodb-resumetoken-decoder

A library for decoding MongoDB resume tokens
TypeScript
8
star
38

react-mapbox-gl-leaflet

React wrapper of mapbox-gl-leaflet for react-leaflet. Demo: https://mongodb-js.github.io/react-mapbox-gl-leaflet
JavaScript
8
star
39

data-service

The MongoDB Data Service
JavaScript
7
star
40

morelikethis

Create more data that has the same shape as existing data.
JavaScript
7
star
41

nodejs-mongodb-legacy

Node.js MongoDB Driver With Legacy Callback Support
JavaScript
6
star
42

compass-import-export

Compass Import/Export Plugin
JavaScript
6
star
43

ace-autocompleter

Ace Editor Autocompleter for MongoDB Queries/Agg Pipelines
JavaScript
6
star
44

download-url

Lookup download URL's for MongoDB versions.
TypeScript
6
star
45

compass-plugin

A khaos template to create internal Compass packages.
Less
5
star
46

interruptor

Run a function with the possibility to interrupt it from another thread
C++
4
star
47

codemirror-mongodb

MongoDB integration for codemirror
JavaScript
4
star
48

system-ca

Access the system certificate store on Windows, macOS and Linux
TypeScript
4
star
49

devtools-docker-test-envs

Docker images and setups for testing
Shell
4
star
50

devtools-connect

A connection establishment utility for MongoDB developer tools
TypeScript
4
star
51

hadron-build

Complete tooling for large-scale Electron apps.
JavaScript
4
star
52

hadron-react

Monorepo for Hadron React Components
JavaScript
4
star
53

electron-installer-run

Run child processes safely handling all sorts of edge cases.
JavaScript
4
star
54

react-d3-unmanaged-wrapper

React component that wraps d3 code inside a div or svg container.
JavaScript
3
star
55

errors

Helpers for handling errors from the MongoDB driver.
JavaScript
3
star
56

compass-schema

Compass plugin for visualizing the inferred schema of a MongoDB collection
JavaScript
3
star
57

index-model

MongoDB index model.
JavaScript
3
star
58

shell

#wip Workspace and docs for MongoDB Shell
JavaScript
3
star
59

is-mongodb-running

Is MongoDB running? What port is it using?
JavaScript
3
star
60

app-migrations

Helper for application schema migrations.
JavaScript
3
star
61

intellij

MongoDB for IntelliJ
Kotlin
3
star
62

win-export-certificate-and-key

Export a certificate and its corresponding private key from the Windows CA store
C++
3
star
63

ejson-shell-parser

TypeScript
3
star
64

redact

Remove potentially sensitive information from objects without changing the shape.
JavaScript
3
star
65

pkg-rpm

Create a RedHat-RPM package for a Node.js executable.
JavaScript
2
star
66

resolve-mongodb-srv

Resolve mongodb+srv:// URLs to mongodb:// URLs
TypeScript
2
star
67

mongodb-mock-server

A mock server useful for testing difficult to reproduce cases in MongoDB drivers
JavaScript
2
star
68

objfuscate

Obfuscates JSON object values recursively, and keys if desired.
JavaScript
2
star
69

compass-connect

Compass plugin for connecting to MongoDB.
JavaScript
2
star
70

backbone-parentmodel

Extensions to Backbone.Model to support nested models and collections
JavaScript
2
star
71

mongodb-schema-parser

WASM/Rust Schema Parser for MongoDB
Rust
2
star
72

compass-collection

Compass Collection Plugin
JavaScript
2
star
73

precommit

Standard linting, formatting and more for mongodb-js projects.
JavaScript
2
star
74

macos-export-certificate-and-key

Export a certificate and its corresponding private key from the default keychain
C++
2
star
75

mongodb-js.github.io

CSS
2
star
76

jsonpath-to-dot

Convert a JSONPath into dotnotation
JavaScript
2
star
77

expression-to-mql

parse arithmetic expressions and convert them to MongoDB aggregation expressions
JavaScript
2
star
78

url

Extend mongodb-uri for more flexibility and data packing.
JavaScript
2
star
79

notary-service-client

πŸ” A client for our notary-service (an API for codesigning).
JavaScript
2
star
80

mongodb-build-info

Extract information from mongodb's buildInfo
JavaScript
2
star
81

electron-wix-msi

TypeScript
2
star
82

ns

MongoDB namespace string (db.collection) parsing and validation
JavaScript
1
star
83

leafygreen-ui-starter-kit

Starter kit for making an application with leafygreen-ui
JavaScript
1
star
84

hadron-application-menu

Atom's application-menu class as a standalone module.
JavaScript
1
star
85

hadron-ipc

Simplified IPC for electron apps.
JavaScript
1
star
86

compass-query-bar

Renders a component for executing MongoDB queries through a GUI.
JavaScript
1
star
87

eslint-config

Shared eslint config for mongodb-js
JavaScript
1
star
88

vscode-mongodb-language

The MongoDB language support for VSCode
TypeScript
1
star
89

compass-database

Compass Database Plugin
Less
1
star
90

metrics

Shareable metric recording.
JavaScript
1
star
91

scope-client

The client to talk to scout-server from node.js or the browser
JavaScript
1
star
92

mongodb-log-writer

A library for writing MongoDB logv2 messages
TypeScript
1
star
93

mongodb-crypt-library-version

Get the version of a MongoDB crypt_shared library programmatically and as a CLI
C++
1
star
94

juttle-mongodb-adapter

2017 skunkworks project
JavaScript
1
star
95

ace-mode

The ACE mode for BSON types.
JavaScript
1
star
96

compass-home

Less
1
star
97

compass-explain-plan

Compass Explain Plan Plugin
JavaScript
1
star
98

learn-mongodb-docs

Main Driver Portal
JavaScript
1
star
99

compass-sidebar

Sidebar plugin
JavaScript
1
star
100

explain-plan-model

Model abstraction for MongoDB explain plans.
JavaScript
1
star