Importing products2.json

Does this file contain the entire data set for the sharding lab?

I get fewer documents than specified – “imported 258390 documents”. Half of all the documents required.

I do not see a products.part1.json file.

Thanks!

Please use products.json only.It will be in your handouts

" Lab - Shard a Collection again

From above link:
Please re-run your mongoimport command for “products.json” only and NOT “products.part2.json”.
Also, make sure you use pass the --drop option to drop the collection if it already exists as shown below.

mongoimport --drop /dataset/products.json --port 26000 -u “username” -p “password” --authenticationDatabase “authDBname” --db m103 --collection products

Then use the correct shard key and try validating the lab, it should work fine. Please let me know if it doesn’t.

Thanks,
Muskan
Curriculum Support Engineer

Hi @rad1206,

The dataset used in the lab is already in your vagrant box inside the /dataset/ directory.
So you can directly import the products.json using the following command:

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

I hope it helps!!

Please let me know, if you have any questions.

Thanks,
Sonali

Hi @Sonali_Mamgain,

I am trying to import the dataset using the exact command that is provided in the lab and is also given by you and I am getting still the “[thread1] SyntaxError: missing ; before statement @(shell):1:14” error.

I am in mongos and did copy your exact command. Any clue what might be the problem?

Hi @dobro2014,

Please run this command outside of the mongo shell and you should be fine. To exit out of the mongo shell, please use the exit command.

exit

Thanks,
MongoDB Support Team

@Shubham_Ranjan It worked. Thank you.