Q: What is Query Assist in Studio 3T? And why is my Studio 3T popping up this warning that it is off?
Welcome to the latest Studio 3T Ask Manatees Anything – #Studio3T_AMA. Want to know how to use Studio 3T to make your MongoDB life better? Just tweet and use #Studio3T_AMA or email [email protected].
A: Query Assist is an interesting feature in Studio 3T. We recommend you keep it on unless you have a very good reason to turn it off. It’s so important, we added a reminder in Studio 3T 2021.8 to help you keep it turned on.
Why? Well, when it’s on, Studio 3T takes on the responsibility in IntelliShell for running queries from start to finish. When it’s off, the queries are passed on down to the mongo shell under the hood. It doesn’t sound like a huge difference, and it’s hard to spot, but it is there.
Without Query Assist
Let’s talk about what happens when a query is run without Query Assist first. Behind the scenes, the mongo command is run, connected to the server and the query sent to it. Studio 3T then captures the output and parses it onto a “Shell Output” view. Now this looks very much like the Collection Views you’ll see elsewhere in Studio 3T but there’s a lot of things missing.
There’s no add, view or edit document buttons. There’s also no update or remove dialog or query code or explain query options. Oh, and no count of documents. That’s a lot missing, but also you are limited, by default, to viewing the first 20 results as that’s what Mongo’s shell produces. There are other surprises too. Run two queries in the shell and their results will be blended together into one table – a touch confusing.
With Query Assist
Now, when a query is run with Query Assist enabled, behind the scenes there’s no mongo command involved. Instead, Studio 3T takes the query and runs it itself using its built in query and display handlers. This uses the Java Driver to talk at high speed to the Mongo server and get the results back.
Those results aren’t coming back as plain text but as data ready to manage inside Studio 3T’s own code. The code is now able to activate all the features, when the data is viewed, because it has already asked for the additional data it needs to track which documents you are looking at. You get the add, view and edit document buttons because now we are tracking the document id, so we know what document you are working with.
That’s the same for the update and remove dialog; now we know what to seed the update and remove queries with. And as we have a handle on the query we can get an explanation of how the query was run. On top of that, the Count Documents control is back so you can get the total number of documents and, as we ran two queries, the results from each are in separate tabs, labelled by line number in the IntelliShell.
But the best part for most people is you can now double click on any field in Table View and edit it in place. With Query Assist enabled, we always know which document and field you are on and can let you make changes.
Keep It On
A feature like that is invaluable and that’s why we nudge you to keep Query Assist Enabled. In an earlier version of Studio 3T we made the Query Assist setting persistent but that has caught some people out as they didn’t notice and were wondering why the powerful table editing was missing.
So do make sure you have Query Assist enabled and only disable it when you have a real need.