An overview of tooling to help you get the most out of using MongoDB on Compose, including:
Note: As Compose MongoDB defaults to using SSL, all examples will include basic SSL enabling options.
To get the MongoDB tools on your local system, you will need to install MongoDB. Details of the installation process are given in the official MongoDB installation instructions but please read on for essential information regarding Compose.
If you already have MongoDB tools installed, ensure they are the same major and minor version as your Compose MongoDB deployment. Run
mongo --version to get the version of the Mongo shell and compare that with your deployment. Currently, Compose runs MongoDB 3.2.x deployments, so you should have MongoDB 3.2.x installed locally.
When you have SSL enabled on your MongoDB database, which is the default on MongoDB at Compose, you need to ensure that your tools are all SSL-enabled too and that you are connecting to the database telling those tools you want an SSL connection.
With the MongoDB command line tools, to check if SSL is enabled run
mongo --help and if there's no
--ssl flag mentioned in the help, you don't have SSL. For Windows and Linux, go to MongoDB's download site and get the latest tools – you'll want to anyway to get up to date – and they'll already have SSL built in. If you are on Mac OS X, we recommend that you setup the Homebrew package manager, then run
brew install mongodb --with-openssl which will compile and install the latest MongoDB with OpenSSL configured.
Then, for the
mongo command and most of the other MongoDB tools, add
--ssl --sslAllowInvalidCertificates to existing commands to connect with only encryption enabled. If you want to validate you are connecting to a particular server, log into your account, select your MongoDB deployment and on the Overview page you'll see an SSL Public Key panel with a Show SSL Public Key button. Click that, enter your password and the page will refresh with the key details. Copy the contents of that key into a file on your local filesystem, say call it
servercert.pem and then, when you run a MongoDB command include
--ssl --sslCAFile servercert.pem in the command line.
f you have exisiting data you would like to move into Compose, data that you want to stage outside of Compose, or just generally have the freedom to move data around, there are a few tools that will help you do so.
First, there is the MongoDB built-in
mongorestore commands. Useful for backups, there are more instructions on how to use them over on the Backups for MongoDB page.
Second, there is the import feature for MongoDB databases that you would like to move into Compose, or to move a database from one deployment to another. To use the import function, use the data browser to create a new, empty database and from the sidebar, navigate to the Imports page.
There are a few limitations on the Imports feature to consider.
- Partial Indexes will not be copied over, causing some indexes to fail. You will need to re-create partial indexes in the new database after running the import.
- DBRefs will be broken by the imports operation. Using Imports is not recommended for databases that depend on DBRefs.
Lastly, the Compose Team has an open-source project named Transporter. It's goal is to move your data from one database to another, even between different database types. You can use Transporter to move your data between any two MongoDB instances. The project lives over in the Transporter GitHub repo, you can read it's documentation, and keep track of it's development and how-tos in the over in Compose Articles.
While the Compose UI has a data browser, user-management, and other features, there are a couple of other GUIs that work with your MongoDB deployments.
Robo 3T (formerly Robomongo) is a free product from Studio 3T, and it's main focus is running queries, creating indexes and viewing documents. You can download it from the Robomongo site. To connect it to your Compose deployment you will need to enter the address and port information from Connection info on the Overview page of your MongoDB deployment.
Setting up a connection in Robomongo.
Studio 3T is the more powerful, paid product from Studio 3T, but there is a free-trial period for 14 days if you would like to get a feel for what it offers. You can download it from the Studio 3T site. To connect it to your Compose deployment you can enter the entire connection string from Connection info on the Overview page of your MongoDB deployment.
Setting up a connection in Studio3T.
There is a side-by-side comparison of these tools in the article Taking a Look at Robomongo and Studio 3T with Compose for MongoDB, if you are exploring either tool for your use-case.
If this article didn't solve things, summon a human and get some help!