Execute Raw query with query editor
Currently there is no query editor for executing raw queries, like for batch update and batch delete. Consider to add a query editor.

-
AdminBetsy (Admin, MongoDB) commented
Hi Rune, thank you for sharing this feedback with my team. I believe this is a duplicate of the raw query editor request that already exists for Compass: https://feedback.mongodb.com/forums/924283-compass/suggestions/40604416-execute-raw-query-with-query-editor
I'm going to merge these requests to consolidate them on our feedback portal. -
Rune commented
Current Workflow Pain Points:
To debug or work on a query (e.g. this query: db.collection("user").find({name: "bob"}).sort({date: -1})), I currently need to perform multiple steps:1. Locate and select the relevant collection (which opens a new tab).
2. Enter {name: "bob"} in the query field manually.
3. Open the "Options" dropdown to find the sort field.
4. Enter {date: -1} in the sort field.
5. Click "Find" to execute the query.This process is cumbersome and time-consuming for frequent query modifications or debugging.
Proposed Solution:
Add a real-time, free-text query interface aimed at advanced users would significantly improve the experience. This feature could:* Automatically re-run the query upon any modifications, streamlining the trial-and-error debugging process.
* Support additional functions like .distinct() or other MongoDB operations without requiring cumbersome conversions from .find() to .aggregate() queries.While using the MongoDB shell is a potential workaround, it lacks user-friendliness for live query editing and experimentation. A more intuitive interface would greatly enhance productivity and flexibility.
Similar / Related feature requests:
* https://feedback.mongodb.com/forums/924283/suggestions/40604416
* https://feedback.mongodb.com/forums/924283/suggestions/44996128 -
AdminBetsy (Admin, MongoDB) commented
Hi, we are considering building a raw query editor. I would also like to call attention to the bulk update and bulk delete features that were added to Compass earlier this year in version 1.42.0, since that use case was raised in the original request.
Here are documentation links describing how to use these features:
https://www.mongodb.com/docs/compass/current/documents/modify-multiple/
https://www.mongodb.com/docs/compass/current/documents/delete-multiple/(Edited by admin) -
Adam commented
I have been putting off using Compass as my go-to DB client for lack of this feature, relying instead on other tools.
I would love to be able to write my own queries, format them how I like - including all the "options" that force me to click into other text boxes - and execute them - preferably with Ctrl+Enter, as the MongoDB Visual Studio Code Extension does.
-
Kai commented
-
Kai commented
This is the main reason why we cannot get rid of our current MongoDB IDE. It's very useful to be able to write javascript code to access MongoDB for various purposes, like creating reports and analyzing the data.
Duplicate (with more votes): https://feedback.mongodb.com/forums/924283-compass/suggestions/40604416-execute-raw-query-with-query-editor
-
Matthew commented
IHAC who has requested this feature as well -- their DevOps team has 100+ shell queries that need to be run (validations, reports, etc) and they currently cannot use Compass for this use case.
-
Igal commented
I'd love to have this feature in MongoDB Compass.
It's the only reason I still use another client (Studio3T).When this is implemented, I can see myself switching to Compass.
-
Adnane commented
For now, there is only a shell but why not have an editor with a MongoDB file extension so we can save and load MongoDB scripts like with MySQL Workbench?
-
AdminMassimiliano (Admin, MongoDB) commented
Just wanted to mention that MongoDB for VS Code could be a viable option for this, if you are looking for an environment that is more editor based: https://www.mongodb.com/products/vs-code.
We are debating whether we should have similar functionality in Compass though.
-
Romain commented
@Mark I just went there to upvote this and found your reply. I didn't know about NoSQLBooster but it's the GUI I've been looking for... The default theme is a bit ugly but it has a lot a features currently missing on Compass (raw queries, autocompletion, saving favorite scripts, queries history, etc...)
-
Mark commented
Totally agree. @Massimiliano - no, the embedded shell is nice, but not adequate. You really should study what NoSQLBooster does with their UI.
For a professional developer, the most important requirement is that you can cut and paste between your code and the query tool (i.e. Compass). For example, if I'm trying to debug a 100 line aggregation pipeline query, I need to be able to copy that from my code into the tool and immediately start debugging (i.e. editing the query and testing). Until Compass has this capability, I won't consider it.
Thanks.
-
Wei Lun Yong commented
Thinking to have a query editor with auto complete.
-
AdminMassimiliano (Admin, MongoDB) commented
Compass 1.22 comes with an embedded shell. Is that close enough to what you are looking for?