You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifying the use command followed by a space, the database name, and a semicolon, does not properly select the database. For example:
use dbname;
will produce switched to db dbname; in the Playground Result tab, but a subsequent find db.colname.find({}); on a collection colname containing documents will produce no results.
However, if instead the command is issued as use('dbname'); the subsequent find command does return results.
Expected Behavior/Code
I would expect the use dbname;, followed by a valid find, to return documents in the specified collection. This syntax appears valid according to both mongo and mongosh shell documentation:
The main issue here is that use dbname; is not valid JavaScript, and we are not in a position where we would want to extend a custom JS parser to handle this specific case. We most likely will make the shell (and thus also vscode) reject input of this form and point the user towards the function-call-style equivalent in the error message.
Bug Report
Current Behavior
Specifying the
use
command followed by a space, the database name, and a semicolon, does not properly select the database. For example:use dbname;
will produce
switched to db dbname;
in thePlayground Result
tab, but a subsequentfind db.colname.find({});
on a collectioncolname
containing documents will produce no results.However, if instead the command is issued as
use('dbname');
the subsequentfind
command does return results.Expected Behavior/Code
I would expect the
use dbname;
, followed by a validfind
, to return documents in the specified collection. This syntax appears valid according to both mongo and mongosh shell documentation:https://docs.mongodb.com/manual/reference/mongo-shell/
https://docs.mongodb.com/mongodb-shell/run-commands/
Environment
The text was updated successfully, but these errors were encountered: