Query
Find, filter, aggregate and script your MongoDB data: the query bar, the Visual Query Builder, Query Code, SQL Query, IntelliShell, the Aggregation Editor, Map-Reduce and Visual Explain.
Oxys DB Studio gives you several ways to ask MongoDB a question. They all work on the same collections and share the same result views, history and saved queries, so you can start in one tool and move the query to another.
| I want to… | Use | Open it with |
|---|---|---|
| Filter, sort and page a collection | The query bar | Open a collection (Enter in the tree) |
| Build a filter without typing JSON | Visual Query Builder | Ctrl+B |
| Get the query as code for my application | Query Code | Ctrl+G, or the Query Code sub-tab |
Write SELECT … FROM … WHERE … | SQL Query | Shift+Ctrl+L, or SQL in the toolbar |
| Run shell scripts | IntelliShell | Ctrl+L, or IntelliShell in the toolbar |
| Group, join and reshape documents | Aggregation Editor | F4, or Aggregate in the toolbar |
| Run a map-reduce job | Map-Reduce | Ctrl+M |
| See how the server runs a query | Visual Explain | The Explain sub-tab |
| Find a query I ran before, or keep one | History and saved queries | Query history, Save query (Ctrl+S) |
Safety first
Querying never writes. The tools that can write say so and ask first:
- IntelliShell asks before a script that updates, deletes or drops anything, and refuses those scripts outright on a read-only connection.
- The Aggregation Editor asks before a pipeline that ends in
$outor$merge. - Map-Reduce asks before writing its result into a collection.
- SQL Query only runs
SELECT.
New to the application? Start with your first query.
- Filter a collection with the query barType a filter, projection, sort, skip and limit above a collection's documents, run it, and keep it as the collection's default query.
- Build a query visuallyAssemble a filter, projection and sort from conditions and groups, or by dragging cells from the result, without writing JSON.
- Turn a query into codeGenerate the current find query, aggregation pipeline or SQL statement as source code for the MongoDB Shell, Node.js, Java, C#, Python, PHP or Ruby.
- Query MongoDB with SQLWrite SELECT statements against MongoDB collections: what SQL Query supports, how it translates to find and aggregate, and what it refuses.
- Run scripts in IntelliShellWrite and run MongoDB shell scripts with completion, result tabs, confirmations before destructive commands and a read-only guard.
- Build an aggregation pipelineWrite a pipeline stage by stage, preview each stage's input and output, run it, explain it, export its result and turn it into code.
- Run a Map-Reduce jobWrite map, reduce and finalize functions, preview each step on a sample, then execute the job inline or into a collection.
- See how a query runs with Visual ExplainDraw the server's query plan as a diagram of stages, with documents passed on, time and data read, to find slow scans and missing indexes.
- Reuse queries: history and saved queriesFind any query you ran in the Query History, save queries by name, organise them in folders with the Query Manager, and load them again.