1

i have downloaded mongodb msi file form mongodb website and i have installed successfully in C:\Program Files\MongoDB\Server\3.2\bin And i used command as mongodb on a command prompt with administrator privileges but error occurred as

C:\Program Files\MongoDB\Server\3.2\bin>mongo
MongoDB shell version: 3.2.0
connecting to: test
2016-01-05T15:08:52.215+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it.
2016-01-05T15:08:52.229+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:224:14
@(connect):1:6
exception: connect failed

image of cmd prompt is attached here

after executing mongod command error is like

C:\Program Files\MongoDB\Server\3.2\bin>mongod
2016-01-05T15:06:15.150+0530 I CONTROL  [initandlisten] MongoDB starting : pid=12512 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-3F1GEI5
2016-01-05T15:06:15.161+0530 I CONTROL  [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-01-05T15:06:15.167+0530 I CONTROL  [initandlisten] db version v3.2.0
2016-01-05T15:06:15.171+0530 I CONTROL  [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-05T15:06:15.179+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2016-01-05T15:06:15.183+0530 I CONTROL  [initandlisten] modules: none
2016-01-05T15:06:15.186+0530 I CONTROL  [initandlisten] build environment:
2016-01-05T15:06:15.190+0530 I CONTROL  [initandlisten]     distarch: x86_64
2016-01-05T15:06:15.195+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2016-01-05T15:06:15.200+0530 I CONTROL  [initandlisten] options: {}
2016-01-05T15:06:15.238+0530 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory C:\data\db\ not found., terminating
2016-01-05T15:06:15.246+0530 I CONTROL  [initandlisten] dbexit:  rc: 100
Community
  • 1
  • 1
Aniket Karne
  • 325
  • 3
  • 14

1 Answers1

5

mongod direct command contain some by default parameter

mongod --dbpath=C:\data\db\   --port=27017

so create a folder data in c then create a db folder in that then run the command

mongod

your server will be in running state now connect to it using

mongo --port=27017    

this will work for you if problem then comment

Rahul Kamboj
  • 449
  • 3
  • 14