Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: allow querying multiple db's #356

Open
glucaci opened this issue Oct 20, 2021 · 1 comment
Open

Feature Request: allow querying multiple db's #356

glucaci opened this issue Oct 20, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@glucaci
Copy link

glucaci commented Oct 20, 2021

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.

@Anemy
Copy link
Member

Anemy commented Oct 20, 2021

@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

@Anemy Anemy added the enhancement New feature or request label Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants