On this page
enableSharding
enableSharding-
The
enableShardingcommand enables sharding on a per-database level. TheenableShardingcommand has the following syntax:{ enableSharding: "<database name>" }To run
enableSharding, use thedb.runCommand( { <command> } )method.To run
enableSharding, connect to amongosinstance and run the command in theadmindatabase.Returns: A document that contains status of the operation. Once you enabled sharding in a database, you can use the
shardCollectioncommand to begin the process of distributing data among the shards.