Docs Menu
Docs Home
/
MongoDB Manual
/ / /

sh.enableAutoMerger()

On this page

  • Definition
  • Compatibility
  • Syntax
  • Method Field
  • Behavior
  • Example
  • Learn More
sh.enableAutoMerger(namespace)

New in version 7.0.

Enables automatic chunk merges for a namespace.

sh.enableAutoMerger() is a mongosh helper method. It is effectively the same as running the configureCollectionBalancing command with the enableAutoMerger field set to true.

Important

mongosh Method

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

For the database command, see the configureCollectionBalancing command.

For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.

This method is available in deployments hosted in the following environments:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

Important

This command is not supported in M0, M2, and M5 clusters. For more information, see Unsupported Commands.

sh.enableAutoMerger( <namespace> )

The method takes the following field:

Field
Type
Necessity
Description
namespace
String
Required
Namespace in the format "<database>.<collection>". Method enables automatic chunk merges for the supplied namespace.

To set the time intervals for automatic chunk merges, use these parameters:

The following example enables automatic chunk merges for "testDatabase.myCollection". Run the example from mongos:

sh.enableAutoMerger( "testDatabase.myCollection" )

Back

sh.disableBalancing