Query on sharding the collection and database

From MongoDB documentation I see that only if the database has sharding enabled, a collection in it can be sharded.
Say if I have a database with 10 collections and I want to enable sharding on one collection in it. If I enable sharding for the database and that one collection, will the other 9 collections be sharded too?
Also if I add few more collections to that database, will the newly added collections be sharded too?

Thanks,
Akshaya Srinivasan

Only collections for which you enable sharding with sh.shardCollection() will be sharded.

When you shard you must specify a shard key. There is no way for the system to know which shard key should be use. So by default collections are not sharded.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.