Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New to MongoDB Can not run command mongo

I was trying to run MongoDB:

   E:\mongo\bin>mongod     mongod --help for help and startup options     Sun Nov 06 18:48:37     Sun Nov 06 18:48:37 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.     Sun Nov 06 18:48:37     Sun Nov 06 18:48:37 [initandlisten] MongoDB starting : pid=7108 port=27017 dbpath=/data/db 32-bit host=pykhmer-PC     Sun Nov 06 18:48:37 [initandlisten]     Sun Nov 06 18:48:37 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data     Sun Nov 06 18:48:37 [initandlisten] **       see http://blog.mongodb.org/post/137788967/32-bit-limitations     Sun Nov 06 18:48:37 [initandlisten] **       with --journal, the limit is lower     Sun Nov 06 18:48:37 [initandlisten]     Sun Nov 06 18:48:37 [initandlisten] db version v2.0.1, pdfile version 4.5     Sun Nov 06 18:48:37 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684     Sun Nov 06 18:48:37 [initandlisten] build info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_42     Sun Nov 06 18:48:37 [initandlisten] options: {}     Sun Nov 06 18:48:37 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db) does not exist, terminating     Sun Nov 06 18:48:37 dbexit:     Sun Nov 06 18:48:37 [initandlisten] shutdown: going to close listening sockets...     Sun Nov 06 18:48:37 [initandlisten] shutdown: going to flush diaglog...     Sun Nov 06 18:48:37 [initandlisten] shutdown: going to close sockets...     Sun Nov 06 18:48:37 [initandlisten] shutdown: waiting for fs preallocator...     Sun Nov 06 18:48:37 [initandlisten] shutdown: closing all files...     Sun Nov 06 18:48:37 [initandlisten] closeAllFiles() finished     Sun Nov 06 18:48:37 dbexit: really exiting now  E:\mongo\bin>mongo MongoDB shell version: 2.0.1 connecting to: test Sun Nov 06 18:48:42 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84 exception: connect failed  E:\mongo>ls GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES  bin  data 

I was looking at http://www.mongodb.org/display/DOCS/Quickstart+Windows and following the instructions. Could anyone tell me what is the problem with running MongoDB (I am using Windows 7)?

like image 500
sophie Avatar asked Nov 06 '11 17:11

sophie


People also ask

Why mongod command is not working?

mongo is not recognized as an internal or external command This error usually occurs because the system can not find the executable that you are asking to launch so to launch the file you have to provide the full path and after that, it will run without any issues.

How do I run a command in MongoDB?

Connect to MongoDB database Then type mongo command to run the shell. Now you are in the Mongo shell. If you want, you can run the mongo and mongod without the command prompt. To do this, go to the installation location and double click on the mongod and mongo applications.

Why is my MongoDB not connecting?

Ensure that your MongoDB instance is running: Compass must connect to a running MongoDB instance. Also check you have installed MongoDB and have a running mongod process. You should also check that the port where MongoDB is running matches the port you provide in the compass connect.


1 Answers

After installing the MongoDB you should manually create a data folder.

 By default MongoDB will store data in /data/db,  but it won't automatically create that directory. To create it, do:  $ sudo mkdir -p /data/db/ $ sudo chown `id -u` /data/db  You can also tell MongoDB to use a different data directory, with the --dbpath option. 

For more detailed information go to MongoDB wiki page.

like image 135
Fatih Acet Avatar answered Oct 01 '22 14:10

Fatih Acet