Here is my mongod.cfg
file:
bind_ip = 127.0.0.1
dbpath = C:\\mongodb\\data\\db
logpath = C:\\mongodb\\log\\mongo-server.log
verbose=v
If it writes that you had not properly shut down or that mongod.lock is not empty , only delete mongod.lock from C:\data\db\ and it will start.
first you run the command mongod and check weather the port 27017 has started or not if yes then hit the command mongo....and database will start.
When This Error is Coming it is lack of the following
1)Setting the path to mongo db go to "C" Drive and the installation of Mongo db directory and then go to bin folder in the mongo and copy the path of it
c:/mongodb/server/3.2/bin/ and create a new environmental variable in system properties then name is path and value="c:/mongodb/server/3.2/bin/" here my version is 3.2
2)create a data directory for the data in C Drive c:/Data/twitter
3)start the server with **
c:/> mongod
check your port config if there is any error as the local port may be assigned to any other 4)start your Mongo database with
Mongo then your mongo db will start
then in your mongo database create a database
use DATABASE_NAME
for example:
use twitterdata
switched to db twitterdata
to check your current database
db
twitterdata
to get total databases
show dbs
Here are the steps to solve this issue:
Point to your mongodb instalation e.g C:\Program Files\MongoDB\Serve\bin and run mongod.exe so you can open connection to 127.0.0.1:27017.