When loading the LoadMovieDetailsDataset.js in cmd shell one error msg is poping up saying that ("db is undefined") and ("microsoft jscript runtime error")

error plz anybody help me im using windows 10

You must connect to your mongo server first before calling load().

1 Like

plz help me out , i have tried to connect to Mongo server but its getting error while connection! after that i’m getting that pop up message saying db is undefined

Anybody plz help me out

Hi @Anudeep_52207,

The error message that you are seeing is normal and you can safely ignore it :slight_smile:

Now you are connected to your sandbox cluster and you can use the load() function to load the loadMovieDetailsDataset.js into your sandbox cluster.

You must provide the full path to your data, when you are loading it into your sandbox cluster. Please refer this post to see how to provide full path.

Note :- Use forward slash

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

Happy Learning :slight_smile:

Thanks,
Shubham Rajan
Curriculum Support Engineer

1 Like


actually i tried the steps but still im getting error message when i tried to open that .js file im getting same pop up message that came before when i was loading the file… if this error message is occured because some fault in my pc or some other case can u tell me plz ?

The message comes from Windows. It means you are still trying to execute the script from Windows. You must connect to a server with the mongo command.

1 Like

after connection was successfully done i tried to load that .js file as shown in lesson but still the error message persists …i tried everything but still that pop up message comes everytime, i think its the fault in my pc or some other java file is missing in my pc

How you are loading the file?
Can you paste the screenshot
First you have to connect to Sandbox cluster and then load the file using load() function as clearly mentioned by Shubham and Steeve
Not clear why you are opening the file

Example below:
MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
Here it is assumed that you are in the dir where file resides
If not you have to give full path of the directory

1 Like

Hi @Anudeep_52207,

Please share the full path of the loadMovieDetailsDataset.js file here so that I can help you with the command.

Thanks,
Shubham Rajan
Curriculum Support Engineer

C:\Users\user\M001\loadMovieDetailsDataset
actually i got it now
the mistake what i did was soon after finding the loaction of “cd loadMovieDetailsDataset”>“dir”>“loadMovieDetailsDataset” instead i should have after “dir” >"( mongo “mongodb://sandbox-shard-00-00-jtpi2.mongodb.net:27017,sandbox-shard-00-01-jtpi2.mongodb.net:27017,sandbox-shard-00-02-jtpi2.mongodb.net:27017/test?replicaSet=Sandbox-shard-0” --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics )" then load the file “load(loadMoviesDetailsDataset”)" its now loaded

Hi @Anudeep_52207,

I’m glad your issue got resolved. If you have any other query please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Rajan
Curriculum Support Engineer

1 Like

Hi @Shubham_Ranjan I am unable to load my the moviedetails dataset as well, on a mac. I checked my permissions and my user is able to read and write to database.

MongoDB Enterprise Cluster0-shard-0:PRIMARY> load("/Users/isabelasobral/m001/loadMovieDetailsDataset/loadMovieDetailsDataset.js")
2019-10-06T19:06:43.413-0700 E QUERY [js] Error: drop failed: {
“operationTime” : Timestamp(1570414000, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { drop: “movieDetails”, lsid: { id: UUID(“558b0df8-cb12-4ddd-98db-eae6b6ec8707”) }, $clusterTime: { clusterTime: Timestamp(1570414000, 1), signature: { hash: BinData(0, A5AC55AABAF8605322F72B92CD1CCB8ABACBBA98), keyId: 6698341139830800385 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1570414000, 1),
“signature” : {
“hash” : BinData(0,“paxVqrr4YFMi9yuSzRzLirrLupg=”),
“keyId” : NumberLong(“6698341139830800385”)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCollection.prototype.drop@src/mongo/shell/collection.js:696:15
@/Users/isabelasobral/m001/loadMovieDetailsDataset/loadMovieDetailsDataset.js:2:1
@(shell):1:1
2019-10-06T19:06:43.413-0700 E QUERY [js] Error: error loading js file: /Users/isabelasobral/m001/loadMovieDetailsDataset/loadMovieDetailsDataset.js :
@(shell):1:1
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

Hi @isabela_53689,

It appears to me that you are connected to the class atlas cluster. Please make sure you are connected to your sandbox cluster before loading the dataset.

For more information on the difference between these two clusters, please refer this post.

Hope it helps!

If you have any other issue, please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Rajan
Curriculum Support Engineer

thank you @Shubham_Ranjan , I have fixed the error.