M103 use mongoimport to import the data

Hi: help please?

You are running mongoimport at mongos prompt which is not correct.
Run from os prompt
Please show the command you ran in the first snapshot

Hi, I am trying to start mongos and authenticate to mongos
mongos -f mongos.conf is not accepted . I did the followings

would you please help ?
I have spent a lot of time on part 1. of the problem “Import and shard a collection”
but still have errors.

I am connected to mongos but when I type db.products.findOne()
the collection products is null. The import has not been done.

Please double check your user ID/PWD
At one place you used M103-admin and at other M103-user
You mongoimport was not successful so you will not find any data

The “products” collection is still null. But when I type show dbs, m103 is listed.

mongos is running on terminal 0 . Mongoimport is done on terminal1

Because you used the argument

--db m103

so please help me find the error.

why the import failed.

It did not fail. If you read the output correctly you will see that it is written than 9966 documents were imported successfully.

Just like @Ramachandra_Tummala already mentioned in this other thread Lab 103 Importing A Dataset - #7 by Ramachandra_Tummala.

1 Like

Were you able to complete your lab?
Steeve was suggesting you to query the correct DB
When you use --db in mongoimport you are asking it to import to target db you passed to --db flag i.e M201
All you have to do is switch to M201then query your products collection