vscode
vscode copied to clipboard
Feature Request: allow querying multiple db's
Feature Request
I would like to query multiple db's in same request.
Context
Give the following playground:
const email = "[email protected]";
use('users');
const user = db.users.find({email: email});
use('orders');
const orders = db.orders.find({userId: user._id});
I would like to see in the result tab the documents from both queries.
[
{
"_id": "..."
"email": "[email protected]"
},
{
"_id": "...",
"userId": "...",
"orderDetails": "..."
}
]
or splited by database
users
[
{
"_id": "..."
"email": "[email protected]"
}
]
orders
[
{
"_id": "...",
"userId": "...",
"orderDetails": "..."
}
]
With the current implementation when executing the above playground it will show only the result from the last query.
@glucaci thanks for the feature request - another alternative is logging the results from those separate queries, console.log
with EJSON.stringify
, limit
, and toArray
should work, which will output the logs to the output panel in VSCode which is usually at the bottom. This won't have the document opening helpers, but will at least be a way to show results from separate dbs.
Something like:
console.log(
EJSON.stringify(db.airlines.find().limit(10).toArray(), null, 2)
);
We also have a feedback forum that allows for upvoting suggested features so this might be a good one to put there: https://feedback.mongodb.com/forums/929236-mongodb-for-vs-code