Collections Tab

The Collections Tab is the starting point for all MongoDB data exploration and analysis in Studio 3T. Here, access can be found to the Visual Query Builder, the Main Query Bar, and the other features associated with the current collection.

Tab Content

 

The Collections Tab shows the contents of a MongoDB collection. It is comprised of the Visual Query Builder, the Main Query Bar, the Results Tab, the Results Tab Toolbar, the Query Code tab, and the Explain tab.

The Collections Tab.

In the above screenshot, Customers is a collection whose documents are shown in the Collections Tab, indicated by the green border. Download the Customers collection to follow along the tutorial.

Visual Query Builder

The Visual Query Builder lets users create MongoDB queries via drag and drop. Simply drag the desired field(s) to the query builder, drop it, set the operators, and run the query. It supports all MongoDB operators and field values.

As the query is built in the Visual Query Builder, the equivalent query will be displayed in the Main Query Bar in the mongo shell syntax

Read about the Visual Query Builder in full.

Main Query Bar

The Main Query Bar mirrors the query being built in the Visual Query Builder in JSON format which users can edit. It includes the Query, Projection, Sort, Skip, and Limit fields.

This tool is especially useful for the experienced developer, but also helps new users gain familiarity with reading and using JSON to build queries.

While the Main Query Bar and Visual Query Builder are reflective of each other, changes in the Main Query Bar will not be seen in the Visual Query Builder.

The Query JSON Editor (“Multi-line Editor Tool”)

While the Main Query Bar only shows parts of a query, the Query JSON Editor displays the entire query in JSON. Here users can edit queries exactly how it would be done in the mongo shell.

To open the Query JSON Editor, click the button to the left of the ‘play’ symbol in the Main Query Bar.

Double-check the code and click ‘Validate’ to ensure the query is being built correctly.

The Run Query Button (“Play”)

Sitting directly to the right of the Query JSON Editor button, the Run (‘Play’) button runs the query on the respective collection. Additionally, this button contains a dropdown menu housing two other operations:

  • “findOne(..)” – returns a single entry matching query
  • “count(…)”. – will return the number of documents matching the query

The Run Query Button

Just above the Run Query and Query JSON Editor buttons are three additional buttons: Search Query History, Bookmark Query Manager,  and Copy Query to Clipboard.

Search Query History

Shows all previous queries ran. Queries are shown in JSON view.

Bookmark Query Manager

Saves oft-used queries and eliminates the need to repeatedly enter queries manually.

Copy Query to Clipboard

Copies the query automatically to the users’ clipboard.

Results Tab

The Results Tab offers three different options to view results and edit data: Tree View, Table View, and JSON View.

Tree View

Tree View allows for users to see the hierarchies in the data. Additionally, data can be edited in-place. Read more about Tree View.

Table View

Table View sorts data into columns and rows similar to a spreadsheet and enables custom views of embedded fields and sub-fields. As with Tree View, in-place editing is also available. Find full documentation of Table View here.

JSON View

JSON View shows the data as JSON documents.

Drag-and-drop query building is not available while in JSON View. However, for fast in-place editing, select the target value and Cmd-J will bring up the JSON editor panel. Read about JSON view here.

In-Place Data Editing

In-place editing is available throughout Studio 3T.  All three views – Table, Tree, and JSON – allow for data editing in real-time.

In Tree and Table View, this is done by double-clicking on any field. Additionally, a multi-line editor can be opened by clicking on the ellipsis icon.

In JSON View, right-click anywhere in the Results Tab and choose Document > Edit Document. This will open the Document JSON Editor.

The Results Tab Toolbar

The Results Tab

Arrow keys
Use the arrow keys to flip through various results pages.
Results per page
Choose to see 1, 10, 20, 50, or 100 results per page.
Refresh Documents
Click the refresh/recycle symbol to refresh results.
Add Document
Creates a new object and allows users to input new data for the corresponding field.
View Document
Opens the current document in JSON view.
Edit Document
Opens the document in JSON editor.
Show Update Dialog
Opens a dialog screen where users can edit update settings.
Show Remove Dialog
Removes documents/fields matching a certain criteria.
Document Count in One Click
To count results, click the Count Documents button on the bottom right hand corner. This returns the number of documents which match the query, in one click.

Query Code

The Query Code tab allows user to convert queries into several different languages. The copy query to clipboard button will copy the code in the target language, thus allowing users to paste driver code easily into their desired application. Currently the languages supported are: mongo Shell, JavaScript (Node.js), Java (2.x driver API), Java (3.x driver API), C#, and Python.

Explain Tab

The Explain tab is one of the most powerful ways of digging into query performance tuning by revealing how it is executing at the line level.

The Explain tab give an in-depth view into query performance.

Updated on September 27, 2018

Was this article helpful?

Related Articles