Overview
Effectively managing a Database Management System (DBMS) offers diverse options, allowing users to choose between the command-line interface (CLI) with mongosh commands or the graphical user interface (GUI) module – Compass, designed for visualizing data. When utilizing mongosh, a foundational understanding of basic commands and CLI usage is essential for efficient data management.
Compass serves as a solution tailored for users or administrators less inclined towards CLI operations, enhancing work efficiency through its nearly intuitive interface. Bridging the gap between Compass and the intricacies of data management, this guide focuses on clarifying the intersection of Compass functionalities, empowering users to harness its full potential. Whether navigating the command line or leveraging the visual appeal of Compass, this instruction provides insights into MongoDB connectivity, ensuring a seamless experience for both novice and experienced users alike.
Compass
In thoughts we can separate connection in two type, for GUI and CLI interface, in that part of instruction we will look at the graphical way connection to the DBMS. You have to install Compass through manager of packages or download from official web-site.
In the Linux system we have to setup GUI shell if they don't exist on the machine, than download them, for Ubuntu we can use code below:
apt install desktop-ubuntu
After installation process start MongoDB Compass through CLI or desktop icon, for Ubuntu you can use command:
mongodb-compass
And for Windows OS, type in the CLI:
MongoDBCompass.exe
Installation file in the Linux OS commonly stored in the /usr/bin and in the Windows OS choosed folder in the installation process. If we did all in a properly way, than we can see pop-up window with field of connection:
Click on the URL field and enter data for connect, if you have MongoDB on your own machine, than click on the Connect button without any changes. If you use remote server replace localhost with internal or external IP-address and indicate port in the case, when administrators use uncommonly setup. And that's it! We are in:
If you have trouble in the connection stage, than check work of DB service, for example in the Ubuntu OS we can type:
systemctl status mongod
And if we see dead process, try to restart them:
systemctl restart mongod
After that, the system will have to work, in the Windows OS you need to look for in the search bar Services and than start MongoDB service!
Mongo Shell
At another side of hand we can use more efficiently way for connection, same at the system we have to setup Mongo DB and Mongo Shell, after that we need check status of daemon as we do before:
systemctl status mongod
And if we have problem with them — restart!
systemctl restart mongod
Alright! Now we can start shell for interact with system, by the command below, in the localhost mode:
mongosh
If there is need connect to remote server use follow command:
mongosh --host <hostname>:<port> --username <username> --password <password> --authenticationDatabase <authDB>
Replace values in the angle brackets with the specific information for your remote server.
Effectively managing a Database Management System (DBMS) provides users with a spectrum of options, presenting the choice between the command-line interface (CLI) utilizing mongosh commands and the graphical user interface (GUI) module – Compass, tailored for data visualization. Proficiency in basic commands and CLI usage is crucial when opting for mongosh.