Testing Mavens
Certification Logo

Using Compass – The GUI tool for interacting with MongoDB

Tue Aug 13 2024

MM
Meera M Bastian
thumbnail

What is MongoDB?

MongoDB is the most popular NoSQL database. Unlike SQL, MongoDB isn’t based on the table-like relational database structure. Data is stored in a format called BSON (similar to JSON format) and use MongoDB query syntax for doing the operations.

MongoDB Compass is a graphical interface to interact with the MongoDB database management system. It comes in handy as it does not require prior knowledge of MongoDB query syntax. It is a convenient tool for testers as it allows to perform the CRUD operations without manually writing queries.

Things to do:

  1. Download and install Mongodb compass in your system

  2. Once downloaded, connect to a host which can be done either by providing the connection string or by filling in the connection fields individually.

  3. After connection is successfully established, you will be able to see the document and collections in it.

  4. Now, click on the collection in which you need to work. Under the options, enter the different criteria based on your action like filter, sort etc.

    Here it retrieved the data based on the input given as userid = “198358” and sorted it by created date.

  5. We can add multiple criteria in the filter like below to fetch the data based on our requirement.

  6. Advanced options are also available here – like export data, Aggregations tab to use aggregate functions , explain plain to know the performance of query, indexes to view the indexes used in the collections,validation rules to view the constraint set during insert/updates.

All these actions required to validate a MongoDB application, can be performed in compass, without the hassle of learning a new querying language syntax. MongoDB Compass is thus a champion for QA/BA’s working with MongoDB.

Background

Your Quality Gatekeepers,

Partner with us today.