Skip to content

"use" command behavior is finicky #355

Open
@scoaste-st

Description

@scoaste-st

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 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:

https://docs.mongodb.com/manual/reference/mongo-shell/

https://docs.mongodb.com/mongodb-shell/run-commands/

Environment

  • MongoDB for VS Code v0.6.12
  • OS: macOS Big Sur 11.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions