Scaling Down MongoDB

If your data size has shrunk and you would like to scale down the size and cost of your deployment, you will have to remove unused data from your deployment, resync MongoDB, and then scale down via the deployment's Resources page. Compose auto-scaling will NOT automatically scale down or remove resources that you are not currently using.

Removing Data from MongoDB

You can remove data from your MongoDB deployment however you like. You can remove single documents, collections, or databases at any time.

🚧

We recommend taking an on-demand backup before doing any major removal operations on your deployment.

Resyncing MongoDB

MongoDB does not automatically free storage from your deployment. It will keep it around for future storage needs should they arise. You will need to free this space from your deployment by performing a resync.

📘

A resync can affect performance. Make sure you understand how this could affect your deployment before performing a resync.

  1. On the Settings panel in the Compose UI, find the Resync Deployment section.
1136

Resync panel.

  1. Click the Resync Deployment button to start the operation.

When the resync is complete, the storage is released and you will be able to scale down via the sliders in the Resources panel of your deployment.

Wired Tiger Deployments

If your deployment is using the WiredTiger storage engine, reclaiming space has to be done with the compact() command. This operation is not currently available to Compose deployments. Please contact support or email [email protected] if you need to reduce the storage consumption of your MongoDB WiredTiger deployment in order to scale down.

Scaling Down

The process for scaling down is much the same as scaling up.

  1. Open the Deployment Resources panel
  2. Click the Scale button
  3. In the Shards panel, use the slider to lower the amount of storage. Note that the slider will not let you move to a position that is less than your currently used storage.
2462

Scaling down a deployment's storage.

The panel displays the change in size and the monthly cost of your deployment. Click Confirm to trigger the scaling operation.

Removing a Shard - Enterprise Horizontal Scaling

Compose Enterprise deployments that have been horizontally scaled by adding additional shards can have shards removed in order to decrease the size of the deployment. If you wish to remove a shard entirely, please contact support.


Still Need Help?

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