Using Compass – The GUI tool for interacting with MongoDB

by: Meera M Bastian

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


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

  1. 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.

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

  1. 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.

Relevant posts

Fluent CI/CD Pipeline – Not just a pipe dream any more thanks to GitHub actions

Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share actions to perform any job you’d like, including CI/CD, and combine actions in a completely customized workflow.

Automating data validation checks in Database Testing

Validating data in the tables becomes very cumbersome if we do it manually. Apart from the longer duration ensuring the accuracy of the data being validated is the biggest challenge. The best way to tackle this scenario is to automate this task which will ensure the data integrity is intact, duplicates are omitted, and the task is completed in a fraction of the time than it used to be.