Skip to content
Monghoul

Run your first query

Open a collection, run a find, read the result six different ways, and find out whether it used an index.

Checked against v1.11.0 Updated
The autocomplete list open on a nested field path, each entry showing its type
Fig 01 Query editor · Typing "shipping." offers only the child fields, with types

Open a collection

Double-click a collection in the sidebar. That opens a query tab bound to that connection and database, with a find already written for you.

Ctrl+K (Cmd+K on macOS) opens the command palette, which searches every connection, database, and collection at once, and > reaches the commands. It is usually faster than the tree once you know what you are looking for.

Write the query

The editor is Monaco, running against the MongoDB Node driver, so the syntax is the syntax you already know:

db.orders.find({ status: { $ne: 'cancelled' } }).sort({ placedAt: -1 })

Completions come from your actual collection schemas, not from a static list of operators. Type a field name and you get its real BSON type; type address. and you get the child fields under it.

The part worth knowing about is what happens inside a pipeline. The editor folds the pipeline stage by stage: $project, $group, $count, $facet, $bucket and $unset reshape the result, and $addFields, $set and $lookup add to it. A field introduced by an earlier stage is still offered to you eight stages later. Where a stage’s output cannot be derived, the whole document is kept rather than guessed at, so valid code is never reported as an error. Schema-aware autocomplete has the full behaviour.

Run it with Ctrl+Enter. Queries and Markdown notes autosave, so a tab you closed by accident comes back with its text.

Read the result

The result pane has six views, and the one you want depends on the question:

View Use it for
Table Scanning many documents with the same shape
Tree One document at a time, with the BSON type of every value
JSON Copying the raw Extended JSON out
Result A write outcome, or a single value
Explain Whether the query used an index, and how efficiently
Chart Seeing the shape of the numbers (Pro)

Switch with the buttons above the result. Ctrl+I opens a preview drawer that follows the focused row.

Check that it used an index

This is the habit worth forming early. Auto-explain collects plan statistics while a read runs, so the result reports its scan type without you running a second query. Hovering that badge details the plan: scan type, index name, documents scanned, and documents returned.

If it scanned the collection, open the Explain view. It grades the plan as collection scan, indexed, optimal, or ungraded, shows the execution plan as a tree, and suggests the index that would remove the scan, with a button that creates it.

You can also paste an explain plan from anywhere else into the explain visualizer, which runs in the browser with nothing installed.

Next

The explain view grading a query that runs a collection scan, with an index suggestion
Fig 02 Explain · A COLLSCAN graded, with the index that would fix it