Connecting to mongodb to fetch data


I wanted to fetch some data from mongodb while writing tests in postman.
So i wanted to know how to install mongo drivers if necessary, and how to connect to particular db and collection inside that and execute a query to get required data.

I dont know if this kind of thing is supported in postman, if not any other alternative suggestions

Hi - You can go through this post which explains on how you can setup a small node server to test your mongoDB database -

Hi Sivcan, this answer does not fully resolve the original question. The question was how (if possible) to connect to MongoDB directly as part of the pre-request script to get the data in order to validate the API under test, not how to design rest api (but
it is useful article in its own right).

Postman only works with REST APIs as of now and thus it cannot establish a DB connection, so you won’t be able to test it out directly.

Yes you’re correct, thus we didn’t mark the previous reply as a solution to the question because it’s a workaround for someone who wants to test out some flows etc.

Thank you. Would you know if there is any plans to add this feature to the postman. I am currently stuck in the scenario of multiple developers working on the seed data and collections. What I want to do is to create some dynamic validation/selection of the input data before it gets consumed by the end point.