what do i do to fix my Mongodb connection error - mongodb

I'm trying to connect to mongodb to set up a database, however i keep encountering an error?
Ive tried redownloading mongo and updating ubuntu but keet getting the error
MongoDB shell version v4.0.9
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-04-24T16:27:11.186+0100 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 :: Connection refused :
connect#src/mongo/shell/mongo.js:343:13
#(connect):2:6
exception: connect failed

Looks like its an error caused due to some kind of permissions .
(OR)
Checkout if the used username and the password is correct or not !

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

MongoDB refused to connect

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

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

Mongo failed to start

I am running a mean app, but when I go to run 'mongo', I get the following error:
MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
2018-07-25T02:15:24.329-0500 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 :: Connection refused :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
I am sure I am missing something simple here.
mongo is the Mongo shell. It connects to the Mongo daemon, mongod, which isn't running - hence the error.
At the command-line: sudo mongod
Enter your password, and the daemon should start. Now, when you run mongo it should start up ok.