Not authorized to load dataset

219 views
Skip to first unread message

Francois van der Hoven

unread,
Feb 8, 2018, 4:59:14 PM2/8/18
to mongodb-user

I am not able to proceed with Lab 2.0 of Chapter 2: The MongoDB Query Language + Atlas. I suspect that I am not connecting correctly, or the problem may be related to the warning message: shell and server versions do not match (see below) I will try and give all the relevant details below.


I am using an Apple Mac with macOS High Sierra version 10.13.3
I am using Google Chrome to connect to https://cloud.mongodb.com/v2/5a7aa13ddf9db150b573ecf0#clusters/connect?clusterId=Cluster0<https://cloud.mongodb.com/v2/5a7aa13ddf9db150b573ecf0#clusters/connect?clusterId=Cluster0>


The mongo version I have installed:
~ $ mongo --version
MongoDB shell version v3.6.2
git version: 489d...
OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016


This is how I login to the shell:
$ 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/test?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.2

2018-02-07T17:57:58.644+1000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] 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)
MongoDB server version: 3.4.10
WARNING: shell and server versions do not match
Cluster0-shard-0:PRIMARY>


When I navigate to the same folder that contains my downloaded file, I cannot load it from my shell:
Cluster0-shard-0:PRIMARY> use video
switched to db video
Cluster0-shard-0:PRIMARY> load("loadMovieDetailsDataset.js")
2018-02-08T08:44:09.450+1000 E QUERY [thread1] [src/mongo/shell/utils.js:25:13] Error: drop failed: {
"ok" : 0,
"errmsg" : "not authorized on video to execute command { drop: \"movieDetails\" }",
"code" : 13,
"codeName" : "Unauthorized"
}
Stack trace:
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCollection.prototype.drop@src/mongo/shell/collection.js:695:1
@loadMovieDetailsDataset.js:2:1
@(shell):1:1


My connection
When I connect to Mongo Shell from https://cloud.mongodb.com/v2/<https://cloud.mongodb.com/v2/>… I click on “I am using shell 3.6 or later” below (2) Connect via the Mongo Shell. I cannot connect with the provided script:

$ mongo "mongodb+srv://cluster0-k9wce.mongodb.net/test" --username m001-student --password m001-mongodb-basics
DNSProtocolError: Invalid SRV answer for "cluster0-k9wce.mongodb.net"
try 'mongo --help' for more information


I will appreciate if someone can point me in the right direction. I trust that the root cause of my problem can be diagnosed from some of the details above.

Wan Bachtiar

unread,
Feb 13, 2018, 7:19:39 AM2/13/18
to mongodb-user

I suspect that I am not connecting correctly, or the problem may be related to the warning message: shell and server versions do not match

Hi Francois,

Below is the error message that is of interest:

2018-02-08T08:44:09.450+1000 E QUERY [thread1] [src/mongo/shell/utils.js:25:13] Error: drop failed: {
"ok" : 0,
"errmsg" : "not authorized on video to execute command { drop: \"movieDetails\" }",
"code" : 13,
"codeName" : "Unauthorized"
}

The message indicates that the user do not have the access needed to drop collection movieDetails. Based on the connection string URI, this is because you’re trying to load the JavaScript file loadMovieDetailsDataset.js to an incorrect cluster. You are supposed to execute the script on your own cluster, which should have been created based on the instruction of Lab 2.0: “Create an Atlas Sandbox Cluster” - not the cluster example provided for the course.

DNSProtocolError: Invalid SRV answer for “cluster0-k9wce.mongodb.net

Please ensure that you have configured any firewall rules or any proxies to allow access to the URI above. As an alternative you can use the connection string format v3.4.

I trust that the root cause of my problem can be diagnosed from some of the details above.

Please be aware that both of the clusters mentioned are only intended for the purpose of MongoDB University M001: MongoDB Basics. If you’re using the cluster to store any data for any other purposes, I strongly recommend either to create a new cluster or change your current cluster credentials.

Regards,
Wan.

Francois van der Hoven

unread,
Feb 15, 2018, 1:27:30 PM2/15/18
to mongodb-user
Hi Wan, 

Thank you for your reply. Your diagnosis that I was trying to connect to the wrong cluster was correct. I have selected the wrong connection string. When I corrected this, I was able to load the file and continue with my exercises.

Regards,
Francois
Reply all
Reply to author
Forward
0 new messages