How to query data in MongoDB Compass

Learn how to query data in MongoDB Compass

How to query data in MongoDB Compass

For this tutorial we are building a query for a parent-child relation. If you need to query more than a simple key:value pair take a look at the MongoDB Compass documentation.

Instructions

  1. In MongoDb Compass go to your desired database/collection.
  2. You can now view your documents and look for the parents you want to query.
  3. Type in Filter {"message.parents.0": "<"Parent">"} and click on Find.

MongoDBCompassQuery
4. This will now filter all documents after the chosen parent.
5. If you now want to process documents (e.g. Group values from multiple documents together, Perform operations on the grouped data to return a single result) try out the Aggregation Pipeline Builder in MongoDB Compass.

Read next

Share, Engage, and Contribute!

Discover how you can share your ideas, contribute to our blog, and connect with us on other platforms.