Sharding A Collection mongoimport directions unclear

The lab for “Sharding A Collection” is clear as concrete.

I have tried this, based on the directions:

mongoimport -h=csrs/localhost:27004 -u=m103-admin -p=m103-pass --collection=products -f=/dataset/products.json --authenticationDatabase=admin -db=m103
2021-08-14T18:12:20.786+0000 WARNING: ignoring unsupported URI parameter ‘replicaset’
2021-08-14T18:12:20.786+0000 error validating settings: can not use --fields when input type is JSON

I will randomly get errors that say I can’t create databases on the config database. Is there an example to which I can refer to get this pattern ?

This version, after I connect to the mongos, also is inoperative.

mongos> mongoimport --db=m103 --collection=products --authenticationDatabase=admin --username=m103-admin --password=m103-pass --file=/dataset/products.json
2021-08-14T18:34:28.315+0000 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:14

It doesn’t work identically if there are no “=” in the command.

This is just a mess.

My mongoimport is being run to port 27001

shard1:PRIMARY> use m103
switched to db m103
shard1:PRIMARY> show collections
products
shard1:PRIMARY> db.products.count();
9966

mongos> sh.enableSharding(“m103”)
{
“ok” : 1,
“operationTime” : Timestamp(1628992641, 6),
“$clusterTime” : {
“clusterTime” : Timestamp(1628992641, 6),
“signature” : {
“hash” : BinData(0,“a6fmpwx0CNbKGwAici62sRLoX+w=”),
“keyId” : NumberLong(“6996465454185185309”)
}
}
}
mongos> sh.shardCollection( “m103.products”, { “sku”: 1 } );
{
“collectionsharded” : “m103.products”,
“collectionUUID” : UUID(“5d02428c-7f27-4307-b565-6c006b522621”),
“ok” : 1,
“operationTime” : Timestamp(1628992790, 4),
“$clusterTime” : {
“clusterTime” : Timestamp(1628992790, 4),
“signature” : {
“hash” : BinData(0,“r24fEn8q/dqo1Vf6wO/wTHo0oqU=”),
“keyId” : NumberLong(“6996465454185185309”)
}
}
}
mongos>

The test:
2 total, 0 passed, 1 skipped:
[FAIL] “The dataset is imported to m103.products”

Did you import the dataset into the ‘products’ collection of the ‘m103’ database?

[SKIP] "m103.products uses the correct shard key "

The count and the response to show collections seem to indicate that yes, I did import the collection.

You should import to mongos

Check mongos.conf for configuration details like port etc.Also check your lab instructions

Your first attempt gave error as hypen missed in --f
Second attempt you tried to run at mongos prompt which gave syntax error
mongo,mongod,mongos commands should be run at os prompt