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:
- Download and install Mongodb compass in your system
- Once downloaded, connect to a host which can be done either by providing the connection string or by filling in the connection fields individually
- After collection is successfully established, you will be able to see the document and collections in it.
- 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.
- We can add multiple criteria in the filter like below to fetch the data based on our requirement.
- 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.