MongoDB on Compose

MongoDB is one of the most popular NoSQL databases around with a JSON/BSON document store and rich query and aggregation frameworks accessible by a wide range of application platforms and languages. Compose gives you access to high-availability, auto-scaling, production quality multi-node MongoDB deployments with just a click.

MongoDB for All is a general introduction to MongoDB on Compose.

Are you wondering what you'll get, or can get, with a Compose MongoDB deployment? Want to know what you'll need to do to manage it? Check out some of the implementation features and details down in MongoDB for Ops and Admins.

Just deployed MongoDB and want to get coding with it? Developing an application or want to try a new stack? Then see the MongoDB for Developers section for resources on how to connect from different languages, command line tools and more information to get you started.

MongoDB for All

When deployed on Compose, MongoDB comes with these standard Compose features.

Compose deployments of MongoDB also come with a number of MongoDB specific features:

  • Data Browser For MongoDB.
  • An optional add-on for real-time log access.
  • The ability to forward rich metrics to services with an optional add-on.
  • Optional Access to the Oplog.
  • Optional WiredTiger storage engine.
  • SSL connections by default.
  • Prices start from $31/mo for a 1GB MMAPv1 deployment and $18/mo per extra gigabyte and from $133/mo for a 4GB WiredTiger deployment adn $30/mo per extra gigabyte.

Compose Configurations

Compose delivers MongoDB in a three data node, single-sharded configuration, with two mongos/haproxy routers handling incoming SSL connections. One data node is assigned to backup and enables no-stop backups.

With MMAPv1, each node starts with 1GB storage and 102 MB of memory in a 10:1 memory/storage ratio and each of the two routers has 64MB of memory.

With WiredTiger, we configure the system to have more RAM available. That means each node starts with 4GB of storage and 1GB of memory in a 4:1 memory/storage ratio.

Both configurations have additional configsvr nodes and an arbiter node to handle system and deployment administration.

Expansion Options

For standard Compose Hosted deployments automatic vertical scaling occurs as your data set grows. You can also manually scale up your portals and MongoDB deployment from the deployment's Resources panel. The memory/storage ratio is maintained, so by increasing the disk allocated to the deployment, you increase the RAM allocated. Additionally, horizontal scaling allows for additional Mongo routers to be added to your deployment.

For more information, see the MongoDB Resources and Scaling page.

Datacenter Availability

See Compose Datacenter Availability for current location availability.

Billing and Costs

Compose deployments are billed on hourly basis and grouped into a single monthly billing cycle. This means that any scaling or add-on usage will be charged from when the new resource was provisioned; not just for the month.

The basic MMAPv1 deployment set up is $31/month. Depending on which scaling and add-ons options you choose, the cost will increase. For example, if you wish to add extra storage and RAM, it is billed at an additional $18/month per unit of 1GB storage/102MB memory, so an additional 2GB storage/204MB memory will cost an additional $36/month.

The basic WiredTiger deployment set up is $133/month. Depending on which scaling and add-ons options you choose, the cost will increase. For example, if you wish to add extra storage and RAM, it is billed at an additional $30/month per unit of 1GB storage/256MB memory, so an additional 2GB storage/512MB memory will cost an additional $60/month.

General billing information, answers, and details can be found in the Billing FAQ

MongoDB for Ops and Admins

High-Availability and Failover

In the standard configuration for MongoDB on Compose, you get a single-shard with three nodes in a replica-set. Mongo will push all write operations on to the primary data node and then propagate them (via the oplog) to the secondary data node on the shard. Should the primary node fail, the secondary will be promoted to primary providing fault-tolerance for your databases. The Mongo routers are responsible for dictating any fail-over, along with load-balancing operations to any of the nodes in the cluster. Three configuration servers exist to help with these operations.

TLS/SSL Connections

HAProxy has been added into the Mongo routers, providing an avenue for secure TLS/SSL connections. By moving the proxy into the mongos router capsule, you will be able to control whitelist IP address filtering and other security access features. TLS/SSL connections are backed by Let's Encrypt.

WiredTiger Storage Engine

MongoDB with WiredTiger has a different resource profile. The compression and caching features mean that disk usage is reduced but at the cost of more CPU and RAM – MongoDB Inc recommend starting with 1GB of RAM. WiredTiger has shown, in use, to be more RAM consuming so we offer it with the recommended allotment.

We start our WiredTiger offering with 4GB of storage and 1GB of RAM. This moves the initial deployment cost to $133. Each extra gigabyte of storage includes 256MB of RAM to support it and costs $30 to scale instead of the additional $18.

We give you the choice of which storage engine you want, but be aware that we do not support swapping storage engines without a complete backup and restore to a new deployment. WiredTiger might not be best for you and your use-case - if you have a smaller dataset, it's best to do your research and make sure you're going to be benefiting from what the engine offers.

Oplog Access

Oplog access is useful for a number of MongoDB based applications including continuous synchronization to other databases and for scaling up platforms like Meteor. Oplog access is now available as an add-on through the Compose console. More implementation and configuration details for oplog add-on can be found on the MongoDB Add-ons page.

MongoDB for Developers

CLI Tools

If you want to connect to your databases from your local system, you will need the mongo command installed, which is available by installing MongoDB locally. Find packages directly from MongoDB. You will want to make sure you have same version as is running in your Compose deployment, as well as having the SSL options enabled. There are installation and usage instructions over on the MongoDB Tools page.

Connecting To MongoDB

The Overview panel of the Compose UI provides the basic information you need to get connected to your databases. In the section Connection info you will find Connection Strings for your application and the Command line for connecting from your local system or development environment. Credentials for accessing your databases can be managed by adding users to your admin database. The Connecting to MongoDB page should get you started, and check out Debugging MongoDB Connections if you are having trouble.

Additional Resources and Related Articles

The full list of documentation for MongoDB is in the sidebar, in addition to all things Compose.

For more than just help docs, check out Compose Articles and our curated collection of MongoDB-related topics for more how-to's and information on MongoDB on Compose.

Still Need Help?

If this article didn't solve things, summon a human and get some help!