MongoDB refused to connect - mongodb

I seem to get this error when I launched mongo
MongoDB shell version v4.4.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
I did do the following:
Delete the mongod.lock file
Restart computer

Related

Error :couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout Error connecting caused by Socket operation timed out

MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout: Error connecting to 127.0.0.1:27017 :: caused by :: Socket operation timed out :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
Everytime when I run mongo command , it says error connecting to 127.0.0.1:27017 caused by socket opeartion timed out.
Tried following many instructions given by peers , but it didn't work.
Hope I get rid of this by your instructions.
Thanks!
Reason: mongodb service is not running
Run mongodb service method:
Open the terminal and execute mongod -dbpath "D:\Program Files\MongoDB\data\db"
("D:\Program Files\MongoDB\data\db" is the directory you created to store data)
Open another terminal and execute mongo

Mongo and mongod command shows error in macos

When I run mongod the following error shows:
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1

MongoDB: Error: couldn't connect to server 127.0.0.1:27017

Installed Mongodb a few weeks ago and worked fine with it until today
This happens when I want to start:
PS C:\mongodb> mongo
MongoDB shell version v4.2.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-05-16T15:30:35.754+0200 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017,
connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by ::
A connection could not be established because the target computer refused to connect. :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-05-16T15:30:35.761+0200 F - [main] exception: connect failed
2020-05-16T15:30:35.761+0200 E - [main] exiting with code 1
PS C:\mongodb>
What can I do to make the connection possible again?
Thanks for a hint.

Connection attempt failed: SocketException: Error connecting to mongodb Error

I deployed the mongodb on my GCP Compute Engine using the bitnami, but my mongodb it's not starting after a restart of my GCP machine, getting the following error:
MongoDB shell version v4.0.6
connecting to: mongodb://ip:27017/admin?gssapiServiceName=mongodb
2019-04-02T10:22:05.815+0000 E QUERY [js] Error: couldn't connect
to server ip:27017, connection attempt failed: SocketException:
Error connecting to ip:27017
:: caused by :: Connection timed out :
connect#src/mongo/shell/mongo.js:343:13
#(connect):1:6
exception: connect failed

Mongodb not connecting after insert with python

Im making a python API and making some inserts , suddenly i cant connect to mongo anymore
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-07-19T07:16:16.067-0300 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-07-19T07:16:16.068-0300 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
Any idea on what could be causing this? my ubuntu