- Reference >
- Database Commands >
- Sharding Commands >
- enableSharding
enableSharding¶
-
enableSharding
¶ The
enableSharding
command enables sharding on a per-database level. TheenableSharding
command has the following syntax:{ enableSharding: "<database name>" }
To run
enableSharding
, use thedb.runCommand( { <command> } )
method.To run
enableSharding
, connect to amongos
instance and run the command in theadmin
database.Returns: A document that contains status of the operation. Once you enabled sharding in a database, you can use the
shardCollection
command to begin the process of distributing data among the shards.