Saved Queries
Quick Start
Access the Query Library to manage your saved queries:
- Open the Query Library from the sidebar or main menu
- Browse your queries organized by connection, database, and collection
- Use the search bar to find specific queries by name or collection
- Double-click any query to run it immediately
- Use folders to organize queries within collections
Understanding the Organization
The Query Library automatically organizes your saved queries in a hierarchical structure for easy navigation:
- Connections - Top-level organization by database connection. Each connection can be expanded to show its databases.
- Databases - Within each connection, databases group queries by the database they target. Expand to see collections.
- Collections - Collections contain the actual saved queries. You can further organize queries using custom folders.
- Custom Folders - Create your own folder structure within collections to organize queries by purpose, project, or any scheme you prefer.
Viewing Your Saved Queries
The Query Library provides multiple ways to view and navigate your queries:
Folder Tree Navigation
- Expand/Collapse Nodes - Click on any connection, database, collection, or folder to expand or collapse its contents. The library remembers your expanded state between sessions.
- Visual Indicators - Each level uses distinct icons and colors: green for connections, blue for databases, cyan for collections, and yellow for folders.
- Item Counts - Each node shows the number of items it contains in parentheses, helping you quickly see where your queries are located.
Query Display
Each query in the list shows:
- Query Name - The descriptive name you gave when saving
- Query Type Badge - Visual indicator showing whether it's a Query (blue), Aggregation (purple), or SQL query (green)
- Collection Name - Quick reference to which collection the query targets
- Last Modified - Relative time (e.g., "2h ago", "3d ago") showing when the query was last updated
Finding Queries
Search Functionality
The search bar at the top helps you quickly locate queries:
- Name Search - Type any part of the query name
- Collection Search - Find queries by collection name
- Database Search - Locate queries by database name
- Connection Search - Filter by connection name
- Folder Search - Find queries in specific folders
- Real-time Results - The tree updates as you type, showing only matching queries and their parent folders
Sorting Options
Two sorting modes help you organize your view:
| Sort Mode |
Description |
Best For |
Name |
Alphabetical order by query name |
Finding specific queries when you know the name |
Date |
Most recently modified queries first |
Quickly accessing queries you've been working with |
Running Saved Queries
Several ways to execute your saved queries:
- Double-Click - Double-click any query in the list to immediately open it in a new activity tab and execute it.
- Play Button - Hover over a query to reveal action buttons, then click the play icon to run the query.
- Keyboard Navigation - Use arrow keys to navigate the list, then press Enter to run the selected query.
- Context Menu - Right-click a query to access a menu with Run Query as the first option.
Note: Running a query opens it in the appropriate activity type (Collection, Aggregation, or SQL Query) based on how it was saved.
Managing Query Details
Renaming Queries
Change the name of a saved query:
- Hover over the query to reveal action buttons
- Click the pencil/edit icon
- Enter the new name in the dialog
- Click Save to update
You can also right-click a query and select "Rename" from the context menu.
Duplicating Queries
Create a copy of an existing query:
- Hover over the query you want to copy
- Click the copy icon in the action buttons
- A duplicate is created with "(Copy)" appended to the name
- Rename the copy as needed
This is useful for creating variations of similar queries without starting from scratch.
Deleting Queries
Remove queries you no longer need:
Delete Single Query
- Locate the query you want to remove
- Hover over it to reveal action buttons
- Click the trash icon (red when hovered)
- Confirm the deletion in the dialog
Alternatively, right-click the query and select "Delete" from the context menu.
Warning: Deleting a query is permanent and cannot be undone. Make sure you have exported important queries as a backup.
Organizing with Folders
Create custom folders to organize queries within collections:
Creating Folders
- Navigate to a collection or existing folder
- Hover over it to reveal the folder-plus button
- Click to open the Create Folder dialog
- Enter a descriptive folder name
- Click Create
You can also right-click a collection or folder and select "Create Folder" or "Create Subfolder" from the menu.
Moving Queries Between Folders
Reorganize your queries using drag and drop:
- Click and hold on a query
- Drag it to a collection or folder
- Release to drop it in the new location
Queries can only be moved within the same connection, database, and collection.
Renaming Folders
- Right-click on a folder
- Select "Rename Folder" from the menu
- Enter the new name
- All queries in the folder are updated automatically
Deleting Folders
- Right-click on a folder
- Select "Delete Folder"
- Confirm the deletion
Warning: Deleting a folder also deletes all queries inside it. This action cannot be undone.
Import and Export
Exporting All Queries
Create a backup or share your entire query library:
- Click the download button in the toolbar (top-right of the window)
- A JSON file downloads containing all your saved queries
- The file includes metadata like creation dates and folder organization
- Share this file with team members or store it as a backup
Importing Queries
Load queries from a file:
- Click the upload button in the toolbar
- Select a JSON file exported from Query Library
- The system validates the file format
- All queries from the file are added to your library
- Duplicate queries are created with new IDs
Tip: Importing does not replace existing queries. If you import a file containing queries you already have, you'll end up with duplicates.
Keyboard Shortcuts
Navigate the Query Library efficiently with keyboard shortcuts:
| Shortcut |
Action |
| Arrow Down |
Move selection down to next item |
| Arrow Up |
Move selection up to previous item |
| Arrow Right |
Expand selected folder |
| Arrow Left |
Collapse selected folder or jump to parent |
| Enter |
Run selected query or toggle folder expansion |
| Page Down |
Jump down 10 items |
| Page Up |
Jump up 10 items |
Note: On macOS, keyboard shortcuts work the same way using the arrow keys and standard navigation keys.
Right-click on any query to access these options:
- Run Query - Execute the query in a new activity tab
- Rename - Change the query name
- Clone - Create a duplicate copy
- Delete - Remove the query (with confirmation)
Right-click on a collection to access:
- Create Folder - Add a new folder within the collection
Right-click on a folder to access:
- Create Subfolder - Add a nested folder
- Rename Folder - Change the folder name
- Delete Folder - Remove the folder and all its contents
Pro Tips
- Persistent folder state - Keep your folder tree expanded the way you like it - the Query Library remembers your expansion state between sessions, so you don't have to keep expanding the same folders.
- Organize by purpose - Use folders to organize queries by purpose (e.g., "Reports", "Admin Tasks", "Testing") rather than by technical details. This makes it easier to find queries when you need them.
- Export for backups - Regularly export your query library as a backup. If you work with critical queries, keep these exports in version control or a backup system.
- Smart sorting - The "Sort by Date" option is great for finding queries you've been working on recently, while "Sort by Name" is better when you know exactly what you're looking for.
- Keyboard navigation - You can use keyboard navigation to quickly browse through queries. Press Enter on a selected query to run it immediately without reaching for the mouse.
- Clone before deleting - Before deleting old queries, consider cloning them first if there's any chance you might need them later. Storage is cheap, but recreating a complex query from memory is not.
- Collection Activity - Where you create and save find queries that appear in the Query Library
- Aggregation Activity - Create aggregation pipelines that can be saved and managed in the Query Library
- SQL Query Activity - Write SQL queries against MongoDB that can be saved to the library
- Save Query Dialog - The interface for saving new queries with names, descriptions, folders, and tags
- Load Query Dialog - An alternative way to browse and load queries from within other activities