How to load files into cluster

To connect to my cluster I have to do as follow

mongo “mongodb+srv://jhmongocluster-eaae2.mongodb.net/test” --username m001-student

As you can see the command is not nearly close to the one used on lecture to load the ReviewsDataset.js file… So I have no idea how to upload it

Would you please let me know how to do it… Also I would like to know how to load the file once you are already in the DB using the mongoshell

The command from the lesson probably is https://docs.mongodb.com/manual/reference/program/mongoimport/ The mongo command is to start an interactive session with the cluster. You can use the same URI with mongoimport.

Hi @Jose_20145,

In your case the command to load the dataset into your cluster would be :

mongo "mongodb+srv://jhmongocluster-eaae2.mongodb.net/video" --username m001-student  --authenticationDatabase admin -p m001-mongodb-basics loadReviewsDataset.js

Note: Please make sure the loadReviewsDataset.js file is present in the same directory from where you have launched the mongo shell.

Once you are inside the mongo shell then you can use the load() function to load the data into your mongodb database.

If you still have any query please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer

1 Like