Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

IntelliShell

Posted on: 30/04/2018 (last updated: 09/03/2022) by Kathryn Vargas
tl;dr
Shortcuts

IntelliShell is the built-in mongo shell in Studio 3T that offers live error highlighting and smart auto-completion of JavaScript standard library functions, shell-specific types and methods, operators, collection names, field names, and shell helper commands. Try it today.

Open IntelliShell – Ctrl + L (⌘+ L)
Trigger auto-completion – Ctrl + Space (^ + Space)
Find – Ctrl + F (⌘+ F)
Replace – Ctrl + H (Shift + ⌘ + F)
Comment with line comment – Ctrl + / (⌘+ /)
Open script – Ctrl + O (⌘+ O)
Save script – Ctrl + S (⌘+ S)
Save script as – Shift + Ctrl + S (Shift + ⌘+ S)
Execute entire script – F5
Execute statement at cursor – F6
Execute selection – F9

Prerequisites

Download Studio 3T and choose the right version for your particular platform and bit size.

IntelliShell requires the mongo shell executable, one of the mongo client tools bundled when downloading MongoDB.

No additional configuration is needed for Windows, macOS, or Linux installations. The mongo shell executable is bundled with Studio 3T on these systems.

If you want to use another version of MongoDB, here’s how you can point IntelliShell to use a different mongo.exe file.

Custom mongo shell

If you choose to use your own installation of the mongo shell, you can configure this in Studio 3T.

Once the mongo client tools are installed:

  1. Go to Studio 3T > Preferences.
  2. Click on the IntelliShell tab.
  3. Insert the path of where the mongo shell executable is located.
  4. Click OK.

IntelliShell is just one of four ways to query MongoDB in Studio 3T.

Launch IntelliShell

Choose a target server, database, or collection in the Connection Tree, then open IntelliShell through three ways:

IntelliShell icon in the toolbar
  • Button – Click on the IntelliShell button in the global toolbar
  • Right-click – Right-click and choose Open IntelliShell
  • Shortcut – Press Ctrl + L (⌘+ L)

When you open IntelliShell on an existing collection, IntelliShell will open with the default query for that collection. You can use Studio 3T’s Query Manager to set a default query.

IntelliShell in a nutshell

IntelliShell has two main sections: the top Editor section where you can write queries, commands, and scripts, and the bottom Result tab section where you can view the shell output.

MongoDB query auto-completion

IntelliShell detects and auto-suggests JavaScript standard library functions, shell-specific types and methods, operators, collection names, field names, and shell helper commands as you type.

MongoDB query auto-completion

You can trigger query auto-completion in three ways:

  • Button – Click on the database icon, next to Enable Query Assist
  • Right-click – Right-click anywhere in the Editor and choose Open Auto-Completion
  • Shortcut – Press Ctrl + Space (^ + Space)

Live error highlighting

IntelliShell highlights syntax errors as you type.

These errors are also noted in the left-hand sidebar as red crosses that you can hover over, and in the right-hand script overview ruler as clickable red markers that take you straight to the error line.

Error highlighting in IntelliShell

Run queries via the mongo shell (Disable Query Assist)

You can execute queries and scripts entirely, at cursor, or just a selection.

Execute a query

To run an entire script:

  • Button – Click on the Run (play) button in the toolbar
  • Right-click – Right-click anywhere in the Editor and choose Execute Entire Script
  • Shortcut – Press F5

To run a script at cursor, place the cursor at any top-level statement and:

  • Button – Click on the second Run (play) button in the toolbar
  • Right-click – Right-click anywhere in the Editor and choose Execute Statement at Cursor
  • Shortcut – Press F6

To run a selection, highlight the part of the query or script to be executed and:

  • Button – Click on the third Run (play) button
  • Right-click – Right-click anywhere on the selection and choose Execute Selection
  • Shortcut – Press F9

The full list of MongoDB shell operators can be found here, which is also directly accessible within Studio 3T through the Shell Methods Reference link in the toolbar.

In the Result tab section, you’ll always find the Raw Shell Output tab which displays the output of all shell-run commands.

IntelliShell Raw Shell Output tab

Should you choose to disable Query Assist in the toolbar, you enable what was previously the Raw Shell Mode in older IntelliShell versions. Results will appear as text output in the mongo shell.

Whenever possible, Studio 3T will parse documents from the Raw Shell Output and display them in a “prettier” Shell Output Documents tab. You can view results through the three standard views (Table, Tree, and JSON), but they will not be editable.

No editing when Query Assist is off

You can run find and aggregation queries, this way but they will no longer open editable result tabs.

Instead, they will appear along with other shell commands and scripts in the Raw Shell Output tab as you would expect in a real terminal or shell, which means you won’t be able to edit or page through the results. Query Code and Visual Explain will not be available.

Run queries via Studio 3T (Enable Query Assist)

Query Assist is enabled by default for standalone, top-level find and aggregation queries. This means they will be run through Studio 3T instead of the mongo shell.

Query Assist adds functionalities that are not available for shell-run queries, like the ability to:

1. Run find and aggregation queries that open their own powerful result tabs. Find queries run using Query Assist allow in-place editing.

Assisted queries are clearly labeled in the left-hand sidebar as wand icons, and in the right-hand script overview rulers as clickable yellow markers that take you straight to the query.

Open results in separate tabs

Each assisted query will open a separate, editable result tab, whose name will display its corresponding line in the Editor.

2. Edit results within the tabs, as you normally would in other parts of Studio 3T through the three standard views: Table, Tree, and JSON.

Edit results in-place

3. Use Query Code to convert your MongoDB query to JavaScript (Node.js), Java (2.x and 3.x driver API), Python, C#, PHP, and Ruby.

Click on the Query Code button on any result tab.

Query Code button

A Query Code tab will open. Choose your target language from the dropdown menu.

Query Code options

Related reading: Query Code – Generate code from MongoDB queries instantly

4. Use Visual Explain to help optimize performance by seeing how MongoDB executed your query.

Click on the Explain Query button on any result tab. This will open a new Explain tab that shows which steps MongoDB took to run the query.

Explain in IntelliShell

Related reading: Visual Explain – MongoDB explain(), visualized

Query Assist only assists find and aggregation queries – all other scripts and commands will always be run in the shell. Their results are viewable in the the Raw Shell Output tab.

Pin only the query results you want to keep

We’ve done away with the Retain option in the old IntelliShell, which as users have told us, led to undistinguishable tabs and general tab clutter.

Tab clutter

Now you can keep things tidy and choose to keep only the query results you need, by clicking on the Pin result button in any result tab.

Pin results option

All other unpinned result tabs will be cleared with the next execution, be it the entire script or a portion of it.

Format and indent code

There are shortcuts in the IntelliShell toolbar to quickly format and indent code:

Format MongoDB query code

To format code:

  • Button – Click on the Format icon, next to Enable Query Assist
  • Right-click – Right-click anywhere in the Editor and choose Format
  • Shortcut – Press Ctrl + Alt + L (or ⌥ + ⌘ + L on Mac)

To indent code:

  • Button – Place a cursor in the target query/query selection and click on the Indent icon
  • Shortcut – Press Tab

To unindent code:

  • Button – Place a cursor in the target query/query selection and click on the Unindent icon
  • Shortcut – Press Shift + Tab

You can define your Editor tab width preferences under Studio 3T > Preferences > General. The default editor tab width setting is 4 spaces.

Editor tab width preference

Insert and remove comments

It is also possible to comment and uncomment with a line comment.

Place the cursor on the line to be made into a comment and:

  • Right-click – Right-click anywhere in the Editor and choose Comment with Line Comment. Repeat to remove the comment.
  • Shortcut – Press Ctrl + / (⌘+ /). Repeat to remove the comment.

Open and save queries

To save your MongoDB query as a JavaScript file:

  • Button – Click on the Save icon. Alternatively, click on the arrow to find the Save As function.
  • Right-click – Right-click anywhere in the Editor and choose Save Script (As)
  • Shortcuts – Save Script – Ctrl + S (⌘+ S), Save Script As – Shift + Ctrl + S (Shift + ⌘+ S)

To open saved queries:

  • Button – Click on the Open icon
  • Right-click – Right-click anywhere in the Editor and choose Open Script
  • Shortcut – Press Ctrl + O (⌘+ O)

Use IntelliShell and Visual Query Builder side by side

Tired of manually typing everything? You can use Visual Query Builder – our drag-and-drop MongoDB query builder – alongside IntelliShell.

Simply click on Show Visual Query Builder in the toolbar.

IntelliShell and VQB

We’ve tightened this integration so that edits made in IntelliShell are reflected in Visual Query Builder in real-time, and vice versa. This way, you can skip the command line writing and build queries visually – or combine both ways to work even faster.


Want to extend your use of the mongo shell? Read on:

  • Discover the Aggregation Editor and break down the MongoDB aggregation pipeline into stages as you build your queries
  • Learn how to create a view in MongoDB (or read our practical introduction to MongoDB views)

How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • What’s New in Studio 3T 2021.1 | A Faster IntelliShell, Now with Live Error Highlighting
  • Why do I see an error when I re-run an IntelliShell script? #Studio3T_AMA
  • IntelliShell Script Tasks
  • What’s New In Studio 3T 2022.8 – IntelliShell Script Tasks and Enhanced Value Searches
  • IntelliShell: Working with Query Assist off

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected