Multiple shell commands that include "use dbName;" statement does not correctly switch database

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Developer Tools, Mongosh

      When a user tries to switch the database using `use dbName;` syntax with multiple commands (single or multiline), the db is not switched correctly. 
      It considers semicolon part of the db name and switches to a wrong database name and as a result all the commands are run against wrong database.

      > use Enron_Email; db.enron_child.findOne()._id;
      < switched to db Enron_Email; // Notice the trailing semicolon in db name
      
      > use Enron_Email;
        db.enron_child.findOne()._id;
      < already on db Enron_Email;
      
      > use("Enron_Email"); db.enron_child.findOne()._id;
      < ObjectId('52af48b5d55148fa0c19965e')
      
      > use("Enron_Email");
        db.enron_child.findOne()._id;
      < ObjectId('52af48b5d55148fa0c19965e') 

       

       

            Assignee:
            Unassigned
            Reporter:
            Basit Chonka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: