All Studio 3T editions come with Visual Query Builder, a MongoDB query builder that works via drag-and-drop.
Instead of writing out complex MongoDB queries (which you can still do on Studio 3T through IntelliShell, our full MongoDB shell integration), the Visual Query Builder provides an intuitive interface that allows you to drag and drop fields while in Tree and/or Table View.
- How to Query
- Tips and Tricks
How to Query
- While in Tree/Table view, click on the Query Builder button on the top righthand side.
- In Table view, click on the field (not the field name!) and drag and drop it onto the Query Builder.
Repeat for additional fields.In Tree view, you can drag and drop multiple fields at once:
- Update the operators and values under the Query, Projection, and Sort sections to show your desired results.
Choose your standard operators in Query section. You can read more about the various MongoDB query operators here.
By default, Studio 3T uses the $and operator to combine queries without the need to state it. Almost always, you would only need to manually state the $or operator.
For the query to work, make sure to first state the $or operator before defining the fields, as in the example below. You can easily overwrite any string value, but you can always trigger a multiline text editor by clicking on the ellipsis (…) icon.When dragging and dropping fields, Studio 3T automatically detects the value type (e.g. Int32, string). But you can also change this manually by clicking on the Value icon.Use the Projection section to explicitly include or exclude a field from your results. And the Sort section to sort results by a particular field in ascending or descending order.You can also see how the written MongoDB query changes as you make updates in the Visual Query Builder, but note that any manual changes made in the Query section will not auto-update your selection in the Visual Query Builder.
- Once the correct values and operators are in place, you’re ready to run your query.
Click on the Play button on top, or the Run button on the bottom of your screen.
Tips and Tricks
You can always view how many results match your query by clicking on Count Documents on the bottom of all collection views.
Order Documents by Creation Date
Skip and Limit
The Skip and Limit functions can save you querying time, especially when dealing with large datasets.
- Skip – skips a certain number of documents (e.g. the first 5,000 documents)
- Limit – limits your result to a certain documents (e.g. only show the first ten results)
Open Collections with Custom Page Size
On the note of saving time when handling large datasets, Studio 3T also lets you define the initial page size when opening a MongoDB collection.
Right-click on any collection, choose Open Collection with Custom Page Size, and define the initial page size.
And there you have it: MongoDB made easy with Studio 3T’s Visual Query Builder! Make sure to read about our Aggregation Editor feature as well, which allows you to write aggregate queries in stages, so that you can ensure your results are always accurate.
Happy querying! 🙂