MongoDB integration in Intellij
This plugin integrates MongoDB Servers with database/collections tree, Query Runner and Shell console.
This plugin was built for IDEA 2019 and upper versions, requires JRE 1.8 and Mongo 3.
Download this plugin from your IDE (Mongo Plugin)
When you open the Mongo explorer, you will see a panel:
[wrench]
icon, set its path in the corresponding field. As alternative, you can use the Terminal plugin.[+]
icon located on the upper toolbar and a dialog will appearSet a label for your server, this will be more convenient to distinguish each of them in the Mongo explorer
Set the server info as the example in the above screenshot
If your access is restricted to a specific database, just set it in the User Database field
If your server requires authentication, click on the Authentication tab and then enter your credentials
When you are done, click on the Test Connection button to check the server configuration.
Additionaly, in Options tab:
row limit
default valueFor each server, the tree displays its databases with all of their collections.
F4
) and the results will be displayed in an editor tab, alongside your open files.If you want clear a collection or database, you can do so by right clicking on it and selecting Drop collection/database (shortcut is DELETE
). Be cautious with this operation, it should not be used in a production environment.
[NEW]
stats
in the below panelImport data
menu item. Select your JSON file and click on Replace all content
option if needed.The panel shows all documents of the collections (max 300 records by default).
You can copy the result and paste it in a text editor.
If you want to see the results in a table view instead, click on the Table icon on the right of the toolbar.
[NEW] You can paginate the results by selecting the number of the documents per page below the results. You will be able to navigate with [<-]``and
[->]` icon
If you want to run a find query, click on the Magnifying glass icon or use the CTRL+F
shortcut.
The query panel will appear at the top.
Type your filter, projection or sort query fragment in JSON format (e.g.: { 'name': 'foo'}
)
If you want to run some aggregate queries, type your pipeline as follows:
{'$operator1': {...}},
{'$operator2': {...}}
Typing CTRL+SPACE
displays a popup that allows you to select a query operator.
Additionally, you can set a row limit.
When you are done, click on the Run button (or type CTRL+ENTER
shortcut) to see the query results.
Any document can be edited by double-clicking on the object id (or by right-clicking and select Edit document). A panel will open at the bottom.
You can edit the value either by double-clicking or by typing F2
.
You can delete a key by right-clicking on it and select Delete this
Set the key name, type and value and then validate your form.
You can also edit a document from scratch by right-clicking in the result view and select Add (or by typing ALT+INSERT
shortcut)
Right click on the ObjectId
of the selected document and select the Delete action
When your document has a DBRef field, you can view the referenced document by right clicking on it and select View Reference action (shortcut is CTRL+B
or ⌘+B
).
The referenced document will be displayed in the same tab. A Back button will appear and allow you to go back to the navigation history.
If you set the mongo client path (e.g., /usr/bin/mongo
), you can run the console by selecting a database under your mongo server node and click on the button Mongo Shell on the toolbar of the Mongo explorer.
If you need to run a JavaScript file on your mongo server, just type CTRL+SHIFT+F10
(or right-click in your file and select Run `myscript.js file)
Select your server and your database then click on the run button.
This project is now built with Gradle with Intellij plugin. At a glance,
gradlew test
to run all unit testsgradlew runIde
to run Intellijgradlew buildPlugin
to build a distribution of the pluginI would like to thank: