In this article on Working with MongoDB Compass, I will discuss MongoDB Compass which is a GUI client for managing the MongoDB database.
MongoDB Compass
Basically, the Compass is a simple and easy-to-use GUI that you can use to visualize and explore the MongoDB database. MongoDB Compass is used for database administration and querying. Furthermore, you can perform queries as well as insert, update, and delete documents using its interface.
When you install MongoDB, the installation wizard shows the option to install MongoDB Compass. So, you need to check that option during MongoDB installation. After the installation is finished, you can launch the Compass. The following interface opens. Next, you can click on the Connect button.
When the Compass is connected with the MongoDB server, the left navigation panel shows the list of databases as shown below.
In order to create a database, click on the Create Database button.
In the dialog box that appears next, you can specify the database name. Also, you need to specify the collection name as well.
When you click on the Create Database button, both the database and the collection appear on the left navigation panel.
After that, click on the collection name. It displays the interface to add documents to the collection. The following figure shows the interface to add data to the collection.
From the Add Data drop-down list you can choose the option to import the file containing data.
It displays the option to import a JSON file or a CSV file.
Now let us create a JSON file containing some data. The file is shown below.
data.json
[ {"emp_id": 111, "emp_name": "Jim"}, {"emp_id": 112, "emp_name": "Mark"}, {"emp_id": 113, "emp_name": "Jill"}]
Click on the JSON option and then click on Select a File… option.
When you click on the Import button, the file is imported and the collection shows the documents.
Further Reading
How to create a MongoDB database using PHP Script?
Create a collection in a MongoDB database in PHP
Insert Documents in a Collection
Show All Documents in a Collection
- AI
- Android
- Angular
- ASP.NET
- Augmented Reality
- AWS
- Bioinformatics
- Biometrics
- Blockchain
- Bootstrap
- C
- C#
- C++
- Cloud Computing
- Competitions
- Courses
- CSS
- Cyber Security
- Data Science
- Data Structures and Algorithms
- Data Visualization
- Datafication
- Deep Learning
- DevOps
- Digital Forensic
- Digital Trust
- Digital Twins
- Django
- Docker
- Dot Net Framework
- Drones
- Elasticsearch
- ES6
- Extended Reality
- Flutter and Dart
- Full Stack Development
- Git
- Go
- HTML
- Image Processing
- IoT
- IT
- Java
- JavaScript
- Kotlin
- Latex
- Machine Learning
- MEAN Stack
- MERN Stack
- Microservices
- MongoDB
- NodeJS
- PHP
- Power Bi
- Projects
- Python
- Quantum Computing
- React
- Robotics
- Rust
- Scratch 3.0
- Shell Script
- Smart City
- Software
- Solidity
- SQL
- SQLite
- Tecgnology
- Tkinter
- TypeScript
- VB.NET
- Virtual Reality
- Web Designing
- WebAssembly
- XML