0

I'm trying to create a new collection in an already existing mongodb database on an ubuntu server. I tried running the command mongod but it says the mongod not found

Red fx
  • 1,071
  • 2
  • 12
  • 26

2 Answers2

1

Make sure your mongo server is running:

you can start using command sudo service mongod restart . Once it started just type mongo , It will take you in mongo console.

Ashish Tiwari
  • 1,919
  • 1
  • 14
  • 26
0

Try mongo.

mongod is the one that starts the server. mongo is the client that connects to the server.

If your environment variable is set correctly, it should work.

If it still says command not found, try /usr/bin/mongo

You can find more info here: https://docs.mongodb.com/manual/mongo/

Dushyant Bangal
  • 6,048
  • 8
  • 48
  • 80
  • I got following error when try mongo Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly. – karthika v nair Oct 25 '17 at 07:13
  • For that, try this: https://stackoverflow.com/questions/27375137/failed-global-initialization-badvalue-invalid-or-no-user-locale-set-please-ens I wont include it in my answer as that was not the issue in your question. You were just trying wrong command. – Dushyant Bangal Oct 25 '17 at 07:14
  • Note that using `export` will just set the variable temporarily. You can either put that in `/etc/environment` or set that everytime you start `mongo`. – Dushyant Bangal Oct 25 '17 at 07:22
  • @karthikavnair if it has solved your issue, can you please accept it as answer? – Dushyant Bangal Oct 25 '17 at 08:48