Error in mongo shell while retrieving data

Ignore this post : I found out where I was wrong. I am connected to the aggregations database and don’t have access to the other database. I have to use the collection = movies inside the db = aggregations. Thank you!


unable to run listCollections, attempting to approximate collection names by parsing connectionStatus

What is this error that stops me from doing any operations in the shell for the labs? The command ‘show dbs’ shows same output as the tutorial. But further steps show me the above error or an authorization error.

Thank you! I was having the same problem.

+1. If I then try to blow by it and type:
db.movies.findOne() I get

2018-11-20T11:03:50.240-0800 E QUERY [js] Error: error: {
“operationTime” : Timestamp(1542740625, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { find: “movies”, filter: {}, limit: 1.0, singleBatch: true, lsid: { id: UUID(“ae7f72e2-69b7-4bac-94a6-2cb6d1dd1883”) }, $clusterTime: { clusterTime: Timestamp(1542740615, 1), signature: { hash: BinData(0, 1C0ECD6FAD75DE2B9AE31E2EFC86EDAF4F451803), keyId: 6595588990781358081 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1542740625, 1),
“signature” : {
“hash” : BinData(0,“zi+2EU57bYuwpksXLDHahYhgV3E=”),
“keyId” : NumberLong(“6595588990781358081”)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCommandCursor@src/mongo/shell/query.js:708:1
DBQuery.prototype._exec@src/mongo/shell/query.js:113:28
DBQuery.prototype.hasNext@src/mongo/shell/query.js:288:5
DBCollection.prototype.findOne@src/mongo/shell/collection.js:260:10
@(shell):1:100:

Hopefully this is a temporary issue. It is preventing me from completing the labs.

The collection named ‘movies’ is the database called ‘aggregations’.

The following should work.

use aggregations
db.movies.find().pretty()

1 Like

Yes I see you saw the problem.

You connected straight into the aggregations database, if you use the connection string provided.

You don’t have access to the other dbs, and mongodb, still doesn’t give a warning when swap to a none existent db, or one that you don’t have access to. It doesn’t need to be an error message, just a warning.

1 Like