Mongo Client

  1. Mongodb Client
  2. Mongo Client Download
  3. Mongodb Client Free
  • Connect to MongoDB

Author: MongoDB Documentation Team

Fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf. Nosqlclient (Formerly Mongoclient), MongoDB Management Tool. Cross-platform and self hosted, easy to use, MongoDB 4.0+ support and more features! Currently only DOCKER builds are supported, desktop distributions will be removed in the next version.

There are several ways to connect to your MongoDB instance.

  • MongoDB Compass for access through a downloadable user interface
  • mongo interactive shell
  • programmatic access through a number of programming APIs.

The following guide steps you through installing the MongoDB client of your choice.

Time required: 15 minutes

What You’ll Need¶

If you are using MongoDB in the Cloud (Atlas), you will need to:

Or, if you plan on using a local instance of MongoDB, you will need to:

  • Install MongoDB and start up an instance towhich you will connect.

Check Your Environment¶

  • Ensure that your client platform is compatible with MongoDB.Refer to the Supported Platformstable for more information.

Procedure¶

Tip

Select the client and environment you will use at the top of this page.

Install your client¶

  • Mongo Shell
  • Compass
  • Python
  • Java (Sync)
  • Node.js
  • Other
    • Motor
    • C#
    • Go

The mongo shell is packaged with the MongoDB ServerCommunity and Enterprise distributions, and is also availablefor users of Atlas as a client-only download.

MongoDB binaries are located in a directory that starts with“mongodb-“. You should see a file named mongo, which isthe shell executable.

If you do not have mongo shell installed, follow theinstall directions for your environment.

If you do not already have a mongo shell, you can downloadjust the shell by logging into Atlas. For your cluster, clickConnect.

Under ChecktheIPWhitelist, add the IP address of theclient you wish to have connecting to Atlas. Then click theConnectwiththeMongoShell. Follow the instructions inthe dialog to download and install the shell.

  • Windows
  • macOS
  • Linux

Download the latest stable version for your environment.

After downloading, click on the downloaded .msi file. TheWindows Installer will guide you through the installation.

Download the latest stable version for your environment.

Double click the tgz file to untar the file.

Download the latest stable version for your environment.

Extract the tar file and locate the mongo executable underthe bin directory of your install root.

To install Compass, see the Compass installation instructions

To install Pymongo, see the Pymongo documentation.

To install the Java driver, see the Java Driver documentation

To install the node.js driver, see the Node.js Driver documentation

To install the C#/.NET driver, see the C# Driver documentation

The MongoDB Go driver can be installed using goget:

The output of this may look like a warning stating something like:

This is expected output.

Alternatively if you are using the dep package manager toinstall the driver,you can install the main mongo package as well as the bson andmongo/options package using this command:

Obtain your MongoDB connection string¶

  • Mongo Shell
  • Compass
  • Python
  • Java (Sync)
  • Node.js
  • Other
    • Motor
    • C#

In order to connect to MongoDB, you will need a URI string. A URI (Uniform Resource Identifier) is similar toa URL, and is supplied as a parameter to the mongoshell, Compass, and the MongoDB drivers when connecting to a MongoDBdeployment.

Note

You can create a URI string for your session in MongoDBGuides by copying and pasting your Atlas connection stringin the form below. Once you copy the string here, anyrelevant code examples within the MongoDB Guides will bepopulated with a URI string. If you have not alreadyretrieved your Atlas connection string, seeSet Up Atlas Connectivity guide.

Mongodb Client

The URI string used in the guides assumes you have set upauthentication for your MongoDB instance, and have created ausername and password for read and write access to a MongoDBdatabase.

If you have already set up a user with thereadWriteAnyDatabase role through the Secure your MongoDB Deploymentguide, you may use that username and password here, alongwith the admin database in your connection string.

Note

The URI form below allows you to create a URI string foryour session in MongoDB Guides by filling out a form. Onceyou fill out the form, any relevant code examples within theMongoDB Guides will be populated with a URI string. You canchange these at any time by repopulating the form.

Important

If your connection string contains $[password], you will needto replace this string with your password. Use cautionwhere you store and enter passwords, particularly when running froma shell or command prompt. Special characters in passwords must beescaped.

Connect to your MongoDB instance¶

Tip

Mongodb

Have you whitelisted your IP address for access to Atlas?For more details see Step 3, WhitelistyourIPAddressandSelectYourConnectionMethod inSet Up Atlas Connectivity.

  • Mongo Shell
  • Compass
  • Python
  • Java (Sync)
  • Node.js
  • Other
    • C#
    • Go

Select the operating system platform on which you are running theMongoDB client you have selected.

  • Windows
  • macOS
  • Linux

Pass the URI to the mongo shell followed by the --passwordoption. You will then be prompted for your password.

Pass the URI to the mongo shell followed by the --passwordoption. You will then be prompted for your password.

Pass the URI to the mongo shell followed by the --passwordoption. You will then be prompted for your password.

If you wish to manually configure your Compass connection, loadCompass and select the NewConnection link. You will see aform where you can enter connection information for MongoDB.

Atlas users can copy a URI string from the Atlasconsole into Compass. MongoDB Compass can detect whether you have a MongoDBURI connection string in your system clipboard and auto-populate the connection dialog from the URI.

See Set Up Atlas Connectivity for information onhow to get the Atlas connection string URI into your copybuffer.

If Compass was already running when you copied the URI string,click the NEW CONNECTION button.

You will be prompted to populate the connection dialog.Click Yes.

You should then populate the password field with theproper password for your MongoDB user in the connection form.

Note

Errors related to connecting through Compass willappear in red at the top of the Connect screen.

It’s a good idea to put your connection code in a class sothat it can be reused.

If your connection_string starts with mongodb+srv, you need to install the dnspython module with

Now add code to call the class you just created.

For the MongoDB java driver 3.7 and beyond, use the MongoClients.create() method.

For legacy drivers (prior to 3.7), use:

The MongoDB.Bson package is used in CRUD operations, soyou’ll import it here.

Replace your password and any parameters surrounded by $[]in the connection string in the code below.

Mongo Client Download

For now, you will use the context.TODO().

Later you’ll configure the context specific to your requirements.

You won’t know if the connection has been successful until youuse the connection. A ping is one way you can test theconnection. This is a full example of a Go connection tomongoDB, including a test ping.

In your Go workspace and project folder, run build.

Now run the binary. For binaries that are not installed, you’llhave to specify the path.

If you’d like to run the resulting binary without specifyinga path, install the binary you just built into your Go workspace.

Now run the code. “yourprojectname” is the name of the projectdirectory that contains the file with your main() function.

For installed binaries use:

For binaries that are not installed, you’ll have to specifythe path.

The default timeout for the Go driver to connect to the databaseis 30 seconds. In the event that you are unable to connect,you will see an error that resembles this:

Summary¶

Congratulations. If you have successfully completed this guide,you have connected to your MongoDB instance. In the next group ofguides, you’ll learn how to create, read, update, and delete datain MongoDB.

What’s Next¶

In the next guide, you’ll learn how to insert data into MongoDB.

See Also¶

For CRUD (Create, Read, Update, Delete) guides:

© MongoDB, Inc 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.

Mongo

MongoDB is a NoSQL database that more than a quarter of developers use in some capacity. What makes MongoDB and other NoSQL DBs attractive is flexibility; instead of being held to a rigid schema that scales vertically, you can evolve your schema as you grow and scale horizontally. MongoDB went public in 2017 and is worth more than $17 billion today.

Document DBs work through nested key-value pairs instead of relational tables and columns. You’re going to need to parse data for your front-end eventually, and with document DBs, your data is already stored in the right format (give or take a .map or .reduce). Working with MongoDB through the command line isn’t exactly a cakewalk: This post will walk through the best MongoDB GUIs available for reading from and writing to your MongoDB clusters.

The Mongo Shell Versus a MongoDB GUI

The most basic way to access MongoDB is through the mongo shell; you can use it to query, update data, and complete admin tasks.

Mongodb Client Free

Mongo Client

It’s included in the MongoDB Server installation, so you’re all set as long as you’re comfortable with shell commands. Traversing objects and writing long queries in the command line can get annoying fast, so using the shell is usually best for quick peeks or admin tasks.

It’s definitely possible to query your Mongo data exclusively from the command line, but if you’re working with even medium-sized datasets, GUIs offer a helpful alternative.

MongoDB GUIs provide a user interface for your MongoDB database that gives you the ability to visualize data and edit queries without the use of shell commands (or with them — more on that later).

The best MongoDB GUIs share similar features:

  • A visual query editor: Click or drag-and-drop elements to create queries.
  • Query autocomplete: Auto-suggestions for collections, fields, methods, and operators.
  • An aggregation framework: Build queries out step-by-step, test along the way, then export into usable code.
  • Server and query analytics: Insights into query and server performance.
  • Relational database to MongoDB data transfer: Automate tedious and error-prone data transfers between database types.

Below is a list of the best MongoDB GUIs that 2021 has to offer. Each one has features that set it apart from the rest. The best one for you will depend on the scope of your project, the features you need, and your budget.

MongoDB Compass


(Image courtesy of MongoDB Compass GitHub Repository)

Overview

The creators of MongoDB (Mongo) have their own GUI called Compass. It’s platform-agnostic and provides a graphical view of your database without the need to use a query language. MongoDB recently announced that the fully featured Compass GUI is completely free for everyone to use. Plus, the repo is now open-source on GitHub.

Some notable MongoDB Compass features include:

  • Schema visualization: Compass visually displays your collections to help you better understand your datasets.
  • CRUD visual editor: Perform CRUD operations within the UI, no need to type queries.
  • Geospatial data: Create queries on map data using an intuitive UI with generated results in both graph and JSON document form.
  • Validation: Write JSON Schema validation rules using an editor that suggests BSON data types and validation keywords as you write

Winning feature: Compass Plugins

One of the best features of the MongoDB Compass GUI is that it has an API for adding plugins. The Compass community has built tons of cool plugins that can generate data for testing, inspect database users, and even check the shard status of the database. If there’s a feature you want but a plugin isn’t available yet, you can build your own using their plugin template.

TablePlus


(Image courtesy of TablePlus)

Overview

TablePlus is a modern, native GUI tool for relational databases like MySQL, PostgreSQL, SQLite, and NoSQL databases like MongoDB. The TablePlus team consists of founder Henry Pham and Windows developer Raccoon Thai. The team, as well as the community, is also fairly active on GitHub.

Some notable TablePlus features include:

  • Customizable UI: There’s no need to turn to Mojave. With TablePlus, you can customize your configurations and their appearance
  • In-line edits: Edit data rows and table structure with a single click

Winning feature: database security

TablePlus promises secure connections. The connection between you and your database is end-to-end encrypted –– no data is sent to a TablePlus server. Additionally, TablePlus ensures database credentials are stored securely in your device’s keychain and comes with built-in SSH. TablePlus also supports multi-step authentication and native libssh.

Robo 3T


(Photo courtesy of Robo 3T blog)

Overview

Robo 3T is an open-source, platform-agnostic, lightweight GUI for MongoDB. Formerly known as Robomongo, the company was bought in 2017 by 3T Software Labs and rebranded (Robo 3T also made it open source).

The project continues to be developed and has 8K stars on Github. In that vein, one of the best parts of using this GUI is the large community of users. Loads of tutorials, guides, and forums are available if you get stuck – just search.

Some notable Robo 3T features include:

  • Code autocomplete: While Robo 3T doesn’t have the autocompleting prowess of IntelliShell (see Studio 3T below), it does have a useful runtime autocomplete feature that works through an internal virtual machine.
  • Fast UI: All operations are done asynchronously, which means the application will never block you from working by freezing up.

Winning feature: embedded Mongodb shell

Many of the MongoDB GUIs have emulatedmongo shells, but this GUI has an embeddedmongo shell. The embedded shell provides increased functionality over an emulated shell because emulators generally run on top of a provided API, whereas an embedded shell works directly with MongoDB.


Subscribe to the Retool monthly newsletter
Once a month, we send out top stories (like this one) along with Retool tutorials, templates, and product releases.


Studio 3T


(Photo courtesy of Studio 3T)

Overview

Studio 3T, formerly MongoChef, is the robust, professional version of Robo 3T owned by the same parent company, 3T Software Labs. Studio 3T is more than just a MongoDB GUI: it’s also an IDE and client. There is no free version of this software (unless you count Robo 3T), and the Core pricing level starts at $149/year per user. Even then, the Core level lacks features that pricier ones have, like SQL import/export, SQL queries, and the schema explorer.

Some notable Studio 3T features include:

  • IntelliShell: A smart, built-in mongo shell with autocomplete that supports Javascript standard library functions, collection and field names, operators, and methods.
  • Three ways to view data: Once you have retrieved your data from the database, you can view it in three different formats:
    • Table View formats the data into rows and columns.
    • Tree View formats the data into expandable hierarchies.
    • JSON View formats your data as JSON documents.
  • Code generation: Export queries into Node.js, Python, Java, C#, PHP, Ruby, or the mongo shell language.
  • Data import: Support for data imports from SQL databases, Oracle, and Sybase.

Winning feature: four ways to query MongoDB and view data

Out of all MongoDB GUIs, Studio 3T provides the most ways to query your database. You can query using:

  1. SQL queries: Query MongoDB using the SQL query language (super cool!)
  2. The mongo shell: Built-in IntelliShell technology that provides robust autocomplete features
  3. The Aggregation Editor: For building up complicated queries
  4. The Visual Query Builder: A drag-and-drop editor for building out queries (fun fact: can be used side-by-side with IntelliShell)

Given this volume of query methods (including less “technical” ones), Studio 3T is usable for anyone, no matter their familiarity with document-based databases, query languages, or command lines.

NoSQLBooster

Overview

NoSQLBooster is a shell-centric GUI with a broad range of features that come with a paid license. The free tier is missing many of the features that make this GUI so great, like code completion and the visual query builder. NoSQLBooster does not work through a subscription model, so once you pay for a license, it’s yours forever (or until you want to update your version).

Some notable NoSQLBooster features include:

Mongo Client
  • IntelliSense: Similar to Studio 3T’s IntelliShell, this language service appears as a tooltip while you type to suggest completions, methods, properties, variables, keywords, collection names, field names, and operators.
  • Interactive samples: In-app tutorials with prewritten queries and descriptions for learning how to use MongoDB.

A notable part of IntelliSense is the built-in snippets that offer code completion for operations like SQL to MongoDB data conversions and date ranges. You can also create your own snippets to save time.

Winning feature: NPM packages in the MongoDB shell script

The best feature of NoSQLBooster is the unique ability to add any NPM package into the MongoDB shell script. In fact, this GUI already comes with a number of useful and popular utility modules — like lodash, moment, bluebird, ShellJS, and math.js — in the global scope, ready to use.

HumongouS.io


(Image courtesy of HumongouS.io)

Overview

HumongouS.io is a fully online MongoDB GUI. Since it’s online, HumongouS.io allows users to collaborate pretty seamlessly. Instead of using it as just a GUI, you can set it up as a more fully-featured internal admin tool. You then don’t need to share database credentials but can instead invite people to collaborate with you from the app. You can even access your data on a mobile device.

Some notable features include:

  • Smart filters: Create filters that you can use to display your collections as chips, which enables quick access
  • Charts and dashboards: Easily create charts and dashboards to track the metrics that are important to you

Winning feature: widgets for customization

With HumongouS.io widgets, you can customize how your data displays and use those widgets to pull data from specific reference collections as needed. There are viewer, form, and layout widgets. Viewer widgets let you represent data in more meaningful ways than default string values.

Form widgets are, according to HumongouS.io’s documentation, “the building blocks of forms.” They’re also customizable, meaning you can match them to any data type in your database.

Layout widgets give you an alternative to the default table view, allowing you to display specialized data.

NoSQL Manager

Mongodb client nodejs


(Image courtesy of NoSQL Manager)

Overview

NoSQL Manager is a shell-based MongoDB GUI tool. NoSQL Manager makes it easy to navigate, view, and edit documents, as well as set limits to maximize performance. You can manage, as the name implies, a lot of things, including collections and their indices as well as users, roles, and functions. It offers support for MongoDB Enterprise, MongoDB on Azure Cosmos DB, and Amazon DocumentDB.

Some notable features include:

  • Wide support: NoSQL Manager supports replica sets, sharded clusters connections, and standalone hosts
  • Document viewer: The NoSQL Manager document viewer and editor offer Tree, Table, and JSON view modes
  • SSH tunneling: NoSQL Manager offers SSH tunneling for MongoDB connections
  • Imports: Import tables from your MySQL and SQL Server databases

Winning feature: autocompletion

NoSQL Manager comes with a MongoDB UI Shell that offers code autocompletion, syntax highlighting, and hints. Autocompletion takes much of the guesswork out of MongoDB management, helping you by autocompleting things like the collection names and methods in MongoDB Shell commands. As you type into the Shell, NoSQL Manager uses context clues to provide collection or method completion.

Bonus: Retool

Overview

Retool is a low code app builder where you can build any GUI for MongoDB (see template). Retool makes it possible to drag-and-drop visual components to avoid boilerplate code and connect to anything with a REST or GraphQL API, meaning you can build a full-featured MongoDB GUI—and include any CRUD operations—in just a few hours.

Some notable Retool features include:

  • Speed: Connecting Retool to MongoDB takes just a few minutes
  • Schema inspection: Visually view your data.
  • Save and share queries: Keep your queries handy for multiple uses.
  • Turn your queries into useful tools: go from query to table, search, and button without writing frontend code.

Winning feature: Customizable front end for visualizing data

You can use Retool’s pre-built components—including tables, buttons, text inputs, and search bars—to not only view your data but do any CRUD operations you need to keep your business going. Once you connect your data sources, you design your frontend with their drag-and-drop component tool.

The Best MongoDB GUI for Your Project

As with any tool, the best MongoDB GUI for you depends on what you’re trying to accomplish.

If you want to completely avoid the command line, MongoDB’s Compass is probably the most fully featured and natively integrated GUI out there. If you want a simple application that has a well-supported community, Robo 3T is the best GUI. If you’re familiar with SQL and want to keep writing queries in everyone’s favorite query language™, NoSQLBooster is going to feel slick. If you’re looking to easily share queries or turn your queries into tools, check out Retool.