Why do we import the dataset to Mongos rather than the Shards

In the lab of Shard a Collection, one step is to import dataset by

mongoimport --drop /dataset/products.json --port 26000 -u “m103-admin”
-p “m103-pass” --authenticationDatabase “admin”
–db m103 --collection products

Why do we import this dataset to Mongos(26000) rather than the shard? So far my understanding is Mongos doesn’t store data itself.

Thanks,
Shuai

Please check this link

You have to issue mongoimport against the mongos instance via the --host parameter so that the routing service can appropriately distribute the data to the shards

2 Likes