Unable to load data into cluster


After setting the working directory to the folder where loadMovieDetailsDataset.js is located and connecting to my cluster via the shell, the command load(“loadMovieDetailsDataset.js”) produces an error stating that I’m not authorized to execute the statements inside the file. Here’s the message on the console:

MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
2018-10-17T14:22:53.211+0800 E QUERY [js] [src/mongo/shell/utils.js:25:13] Error: drop failed: {
“operationTime” : Timestamp(1539757359, 16),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { drop: “movieDetails”, lsid: { id: UUID(“16191380-7b7c-4994-88f3-feaae6de1372”) }, $clusterTime: { clusterTime: Timestamp(1539757328, 1), signature: { hash: BinData(0, 64593FC83F9A16830FB351892A672935E3B62D61), keyId: 6559514413705986049 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1539757359, 16),
“signature” : {
“hash” : BinData(0,“qnjM8Ekx5SpEbOKuJxuZ/GSdwmU=”),
“keyId” : NumberLong(“6559514413705986049”)
Stack trace:

2018-10-17T14:22:53.211+0800 E QUERY [js] Error: error loading js file: loadMovieDetailsDataset.js @(shell):1:1

Any thoughts why this may have happened? Did I fail to set permissions somewhere or something?

Thanks in advance!

Hi Dexter_18750,

The issue can be because of 2 possible reasons:

  • You are by mistake are connected to our Atlas cluster i.e cluster0-shard-00-00-jxeqq.mongodb.net instead of yours. Make sure you are connected to your cluster.
    I say this because error includes drop: “movieDetails” which should not be already present in your sandbox.

  • Second, You have not created user and password on the Cluster that you have created. Please create the user and run the command again to successfully authenticate against the cluster.

Let me know if it works!


Hi Kanika,

You were right. I was connecting to your Atlas cluster instead of the one I had set up. Changing the three addresses fixed it for me.


1 Like


Anyone pl guide me how to create and connect my own cluster instead of default one (cluster0)

mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/100YWeatherSmall?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

I am trying to open my personal cluster from inside the local loadMovieDetailsDataset directory and its giving me an error how ‘mongo’ is not recognized as an internal or external command

Hi Ramya_02280,

It is already taken care by the lecture: Chapter 2: Create Your Own Sandbox Cluster

Please go through it and let me know if you still face issues.


HI Lauren_06134,

The error suggests me to look for if mongo is installed on your system and environment path is correctly set.


Hello Lauren,
I assume you have set the path in our Windows environment. Looks like the path is not correctly set. Here is a image of path I have set at the beginning of path variable as C:\Program Files\MongoDB\Server\4.0\bin;

If the path is correctly set, when you open a CMD prompt and type ‘mongo’ without quotes, you should see something like this -

Hope this helps
PS- Just noticed this was an old query dated Oct 2018! I will keep the answer as it can help someone else facing similar issue.