I am connecting to MongoDB hosted on EC2 instance of AWS. I am connecting through ssh command. Upon entering the command "show collections", I am getting uncaught exceptions. Please see the sequence below. Can you let me know how can I start seeing the collections again when putting in the "Show collections" command?
show dbs admin 0.031GB cool_db (empty) local 0.031GB users 0.031GB use users switched to db users show collections 2019-08-26T18:46:15.280+0000 E QUERY [js] uncaught exception: Error: listCollections failed: { "ok" : 0, "errmsg" : "no such cmd: listCollections", "code" : 59, "bad cmd" : { "listCollections" : 1, "filter" : {
},
"nameOnly" : true,
"authorizedCollections" : true
}
} : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:834:15 DB.prototype._getCollectionNamesInternal@src/mongo/shell/db.js:906:12 DB.prototype.getCollectionNames@src/mongo/shell/db.js:915:12 shellHelper.show@src/mongo/shell/utils.js:893:9 shellHelper@src/mongo/shell/utils.js:790:15 @(shellhelp2):1:1
version()
anddb.version()
in themongo
shell? It looks like you are using a newer version of themongo
shell with an older (pre-3.0) version of MongoDB server. The major version of shell & server (x.y) should ideally match.listCollections
command was added in MongoDB 3.0 so this would be an unexpected error for a 3.6 server. Are you sure the server is 3.6? What is the exact server version (x.y.z)? If you are connecting viassh
and runningmongo
on the remote host (where themongod
is), it also seems unusual to have a different version of the shell from the server. Are you port forwardingssh
? The easiest fix to ensure compatibility would be installing a matching version of themongo
shell. Your 4.2 shell should be displaying a message on startup:WARNING: shell and server versions do not match
.bash
shell but would not be able to do so only using themongo
shell. MongoDB 2.6 reached End of Life in Oct 2016, so you definitely should be planning to upgrade. In the interim I would download a 2.6 version of themongo
shell as a lot has changed since then.