Where is problem can't load js file

C:\Users\MyPC>cd M001

C:\Users\MyPC\M001>dir
Volume in drive C has no label.
Volume Serial Number is 5C26-B733

Directory of C:\Users\MyPC\M001

21/10/2018 18:28 .
21/10/2018 18:28 …
21/10/2018 16:28 loadMovieDetailsDataset
0 File(s) 0 bytes
3 Dir(s) 89,459,900,416 bytes free

C:\Users\MyPC\M001>cd loadMovieDetailsDataset

C:\Users\MyPC\M001\loadMovieDetailsDataset>dir loadMovieDetailsDataset
Volume in drive C has no label.
Volume Serial Number is 5C26-B733

Directory of C:\Users\MyPC\M001\loadMovieDetailsDataset\loadMovieDetailsDataset

21/10/2018 16:27 .
21/10/2018 16:27 …
21/09/2018 17:00 1,381,666 loadMovieDetailsDataset.js
1 File(s) 1,381,666 bytes
2 Dir(s) 89,458,999,296 bytes free

C:\Users\MyPC\M001\loadMovieDetailsDataset>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
MongoDB shell version v4.0.3
connecting to: 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
2018-10-21T20:28:29.883+0200 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017
2018-10-21T20:28:30.411+0200 I NETWORK [js] Successfully connected to cluster0-shard-00-01-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01-jxeqq.mongodb.net:27017 with a 5 second timeout)
2018-10-21T20:28:30.443+0200 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02-jxeqq.mongodb.net:27017 with a 5 second timeout)
2018-10-21T20:28:31.053+0200 I NETWORK [js] Successfully connected to cluster0-shard-00-00-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-jxeqq.mongodb.net:27017 with a 5 second timeout)
Implicit session: session { “id” : UUID(“c6beafb6-4223-4405-be2d-719062dc188f”) }
MongoDB server version: 3.6.8
WARNING: shell and server versions do not match
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
100YWeatherSmall 0.128GB
admin 0.000GB
aggregations 0.067GB
citibike 0.363GB
city 0.002GB
config 0.000GB
coursera-agg 0.083GB
local 1.043GB
mflix 0.292GB
results 0.000GB
ships 0.001GB
video 0.458GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
2018-10-21T20:33:22.095+0200 E - [js] file [loadMovieDetailsDataset.js] doesn’t exist
2018-10-21T20:33:22.095+0200 E QUERY [js] Error: error loading js file: loadMovieDetailsDataset.js :
@(shell):1:1
MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(“loadMovieDetailsDataset.js”)
2018-10-21T20:36:32.659+0200 E QUERY [js] [src/mongo/shell/utils.js:25:13] Error: drop failed: {
“operationTime” : Timestamp(1540146988, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { drop: “movieDetails”, lsid: { id: UUID(“c6beafb6-4223-4405-be2d-719062dc188f”) }, $clusterTime: { clusterTime: Timestamp(1540146798, 1), signature: { hash: BinData(0, 8EB514272FFC316946FEB46FF4DC65269EAA57C5), keyId: 6559514413705986049 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1540146988, 1),
“signature” : {
“hash” : BinData(0,“Xc0bMe/lTq8MlpIeTqTsRF3VBOo=”),
“keyId” : NumberLong(“6559514413705986049”)
}
}
}
Stack trace:
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCollection.prototype.drop@src/mongo/shell/collection.js:707:1
@loadMovieDetailsDataset.js:2:1
@(shell):1:1

2018-10-21T20:36:32.660+0200 E QUERY [js] Error: error loading js file: loadMovieDetailsDataset.js @(shell):1:1
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
100YWeatherSmall 0.128GB
admin 0.000GB
aggregations 0.067GB
citibike 0.363GB
city 0.002GB
config 0.000GB
coursera-agg 0.083GB
local 1.043GB
mflix 0.292GB
results 0.000GB
ships 0.001GB
video 0.458GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
movies
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieDetails.find().pretty()
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

Where is problem?

the problem is the js file is not in the folder you are in. you need to make sure to put the js file in there before you run the load command. Also I think you will want to load this data into your atlas cluster.

2 Likes
[quote="Nada_78807, post:1, topic:2690"] “errmsg” : “not authorized on video to execute command { drop: “movieDetails”, lsid: { id: UUID(“c6beafb6-4223-4405-be2d-719062dc188f”) }, $clusterTime: { clusterTime: Timestamp(1540146798, 1), signature: { hash: BinData(0, 8EB514272FFC316946FEB46FF4DC65269EAA57C5), keyId: 6559514413705986049 } }, $db: “video” }”, “code” : 13, [/quote]

As @shahid_76258 alluded to, it appears you are trying to load the data into the class cluster which you will not have access to. You need to load it into the atlas cluster you are instructed to create.

MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video switched to db video MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections movies MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieDetails.find().pretty() MongoDB Enterprise Cluster0-shard-0:PRIMARY>

Where is problem?

The problem here is there is no collections “movieDetails”, just “movies”. You need to switch to the correct cluster.

HTH,
Mike

1 Like