Alon Alon - 1 month ago 8
Bash Question

Cannot open Mongo shell on Ubuntu

I've installed MongoDB on Ununtu 14.

How do I open the its shell?

I followed this: https://docs.mongodb.com/manual/mongo/, which told me to run ./bin/mongo in my Mongo installation directory. Afaik the Mongo installation directory in my computer is var/lib/mongodb, but I don't see any "bin" directory in there, just the following files and directories: journal, local.0, local.ns, mongod.lock, storage.bson, _tmp.

Any help will be profoundly appreciated!

Answer

The folder you are looking into is not the mongodb installation folder, but where it stores the data.

If you have installed mongodb through package manager, you can do (to make sure mongodb is running):

sudo service mongod start

And then just use the

mongo

command, as it should already be on your path

You can check here for more information