Problem running loadReviewsDataset.js to upload Reviews Collection

Per the lecture, when in the shell and using the video database I typed the following –
loadReviewsDataset.js
This did not work. Error saying loadReviewsDataset is not defined.

Tried it from the command prompt (C drive) got "is not recognizad as an internal or external command.

Tried navigating to the M001/loadReviewsDataset directory where I have it stored and then running it.
Got a pop-up asking if I wanted to open it but if I said yes got error ‘db’ is undefined. If no got “Access is denied” at command prompt.

Tried – load(“loadReviewsDataset.js”) Got Error saying “file doesn’t exist” when trying the command in the Mongo shell.

From the command prompt tried –
mongo “mongodb+srv://sandbox-une7l.mongodb.net/test” --username m001-student --password m001-mongodb-basics loadReviewsDatasest.js
This seemed to work, no error message but Reviews did not subsequently show up in Collections.

Please help!

Thanks.

  1. Login to your Sandbox cluster

  2. Execute the load() function by specifying the absolute/full path to the file using forward slashes:

    load("C:/absolute/path/to/file/loadReviewsDataset.js")

2 Likes

That worked! Many thanks!

Closing this thread as the issue has been resolved.