翻译或纠错本页面

enableSharding

enableSharding

The enableSharding command enables sharding on a per-database level. The enableSharding command has the following syntax:

{ enableSharding: "<database name>" }

To run enableSharding, use the db.runCommand( { <command> } ) method.

To run enableSharding, connect to a mongos instance and run the command in the admin database.

返回: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.