Sunday, October 6, 2019

How to solve : Ubuntu MongoNetworkError and to start MongoDB server on system start?

If you get en error such as:

(node:6468) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Server is running on port 8000
(node:6468) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

This is actually not an error... What happens here is that Mongo relies on a daemon in order to run the local database server, so in order to "fire up" the mongo server in your shell, you have to start the mongo service first.

1 sudo service mongod start
2 mongo
And there you have it! the server is going to run. Now, If you want Mongo service to Start when the system boots then you have to run:
systemctl enable mongodb.service

Best way to Install ROBOMONGO Program Into UBUNTU Using Command Line

1. Download tar.gz file from Official robomongo website(choose version you need to install and get it's tar.gz download file url)
wget https://download.robomongo.org/0.9.0/linux/robomongo-0.9.0-linux-x86_64-0786489.tar.gz
2. Extract tar.gz file
 tar -xvzf robomongo-0.9.0-linux-x86_64-0786489.tar.gz
3. Move files and folders into the result folder from extraction operation into folder robomongo under /usr/local/bin
sudo mkdir /usr/local/bin/robomongo
sudo mv  robomongo-0.9.0-linux-x86_64-0786489/* /usr/local/bin/robomongo
4. Make sure excute file for robomongo program which exists under/usr/local/bin/robomongo/bin folder is excutable file
cd /usr/local/bin/robomongo/bin
sudo chmod +x robomongo ## run command only if robomongo isn't excutable file
./robomongo

How to solve : Ubuntu MongoNetworkError and to start MongoDB server on system start?

If you get en error such as: (node:6468) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be re...