In this post, we’ll show you how to get started with IntelliShell, Studio 3T’s full MongoDB shell integration.
Enjoy the richest editing experience only our MongoDB GUI, available for Windows, Mac and Linux.
- Configure IntelliShell
- Open IntelliShell
- Enable Dark Theme
- Special Note for Secondary Replica Set Members
Install Studio 3T
In case you haven’t yet, you can download our MongoDB GUI for your particular platform and ‘bitness’.
For example, if you wish to download the 64-bit or the 32-bit Windows version, click on More Download Options in the ‘WINDOWS’ section. Likewise for Linux, but this time in the rightmost ‘LINUX’ column.
For ‘MAC’, you can download the Archive (.dmg) file with or without the bundled shell.
For Windows, there is a standard installer. For Mac, there is a standard ‘drag to the Applications folder’ style installer. On Linux, you can unpack the download to a location of your choice by issuing the command
tar -zvxf studio-3t-linux-x64-dist.tar.gz
tar -zvxf studio-3t-linux-x86-dist.tar.gz if you downloaded the 32-bit version) and then run the
launch script from within the unpacked directory.
If you’ve installed Studio 3T on a Windows x64 or a Mac, you’re ready to run IntelliShell without additional configuration. The mongo shell executable is bundled with Studio 3T on these systems.
If you’ve installed Studio 3T on a Windows x86 or Linux, or prefer to run your own mongo client tools on Windows x64 or Mac, read on to install the needed mongo client tools.
Install mongo client Tools
MongoDB provides a number of command line tools for client machines. Studio 3T’s IntelliShell requires one of these, the
mongo shell executable, to be accessible on your machine. To install it, go to https://www.mongodb.org/downloads.
mongo shell is typically backward compatible with MongoDB database deployments of previous versions.
For example, if you have to work with, say, a legacy MongoDB 2.4 system, a current 2.6 system and a new 3.0 system, you do not need to install the distribution for all those different versions.
Simply install the latest version of the distribution and you’ll be able to use it with all of the different versions of MongoDB deployments you need to work with.
Also note that if you are going to work with a MongoDB deployment that requires SSL encryption to connect to it, be sure to download a distribution that supports SSL encryption.
As of this writing, the latest versions of the Windows and Linux distributions do (though on Linux, you must also have the OpenSSL libraries installed).
On Mac, the Homebrew package manager provides options to install an SSL-enabled version of the
You can also enable SSL support by building the tools from source, which is actually not as scary as it sounds.
The Windows MongoDB distribution is a standard Windows installer, the Mac and Linux distributions must be unpacked to a location of your choice using the command
tar -zvxf mongodb-<...>.tgz
mongodb-<...>.tgz refers to the name of the file you downloaded. (On Mac, you can also just double click the file to unpack it.)
OK, we have everything we need installed, so let’s start Studio 3T.
Once you’ve installed the mongo client tools, we need to configure Studio 3T so that it knows where to find the
mongo shell executable we just installed.
Click on the Preferences menu (located in the application menu on Mac and in the ‘Edit’ menu on Windows and Linux) and then on the IntelliShell tab.
If you have previously had MongoDB installed on your system and the
mongo shell is available on your PATH, it will be shown in the second option:
However, in this post we are going to select the particular version we just installed. To do this, select the third option and locate the
mongo shell executable.
On Mac and Linux, this will be a binary file simply called
mongo located in the ‘bin’ directory where you unpacked the distribution.
On Windows, it is a binary file called
mongo.exe and is located in the ‘bin’ directory of the MongoDB install location in ‘Program Files’. It will be a path similar to ‘
Now that that is configured, click OK, and we can start using Studio 3T’s IntelliShell.
You can open IntelliShell in three ways:
- Right-click on your connection, database or collection and select Open IntelliShell
- Click IntelliShell on the toolbar
- Use the keyboard shortcut
Note that if you do open at the connection level, you’ll be connected to the ‘test’ database as per the MongoDB default. So if your queries suddenly start returning no results – check you’re actually using the database you think you are!
We can now begin getting more done on the richest MongoDB shell experience currently available in a MongoDB GUI.
IntelliShell has autocompletion not only of collection names and shell methods, but also of document key names, operators and further completions on return values, just the way you want it.
Speaking of autocompletion, you can always trigger it by pressing CTRL + Space. Or right-click anywhere in the IntelliShell editor pane and choose Open Auto-Completion.
Below is the list of IntelliShell keyboard shortcuts. We also recommend to check out the full list of Studio 3T hotkeys to save you even more time.
Ctrl + L (⌘+ L) – Open IntelliShell
Ctrl + Space (^ + Space) – Trigger autocompletion
Ctrl + F (⌘+ F) – Find
Ctrl + H (Shift + ⌘ + F) – Replace
Ctrl + / (⌘+ /) – Comment with line comment
Ctrl + O (⌘+ O) – Open script
Ctrl + S (⌘+ S) – Save script
Shift + Ctrl + S (Shift + ⌘+ S) – Save script as
F5 – Execute entire script
F6 – Execute statement at cursor
F9 – Execute selection
Enable Dark Theme
In case you prefer a dark editing mode, you can enable dark theme on IntelliShell following these steps.
Special Note for Secondary Replica Set Members
Note that if you are connected to a replica set and want to run IntelliShell on a secondary member (for example, the replica set connection has a read preference of
secondaryPreferred), you will first need to run
rs.slaveOk() to be able to query freely.
In MongoDB, reads to a primary have strict consistency, meaning that the data it provides reflects the latest writes at all times. This is more familiar and easier to work with when coming from other database systems.
Reads to secondaries in MongoDB however, have eventual consistency, meaning that changes to the system can propagate gradually and readable members are not required to reflect the latest writes at all times. This is less common and may surprise some users coming from other database systems.
rs.slaveOk() you are indicating to the system that you acknowledge that reads will be eventually consistent and wish to be able to query the secondary anyway.
Following the principle of self-documenting code,
rs.slaveOk() should really be called
rs.iUnderstandThatHereReadsAreEventuallyConsistent AndIAmHappyToLiveWithTheConsequences SoPleaseLetMeQueryFreely(), but unless you have the amazing IntelliShell code completion available to you, that would be a little straining on the fingers.
OK, that’s it for this post. Using the MongoDB shell has never been so tasty, and I hope you’re now successfully up and running with Studio 3T’s IntelliShell.
We’re always very keen to hear about your experiences and ideas for Studio 3T. If you’d like to tell us about them please visit our feedback page or click the ‘Feedback‘ toolbar button in the app.
Editor’s Note: This post was originally published in May 2015.