[SERVER-3119] shell prompt is incorrectly changed after creating a new Mongo object Created: 19/May/11  Updated: 15/May/15  Resolved: 15/May/15

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 1.8.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Problem:
It appears creating a new Mongo object in the shell causes the shell prompt to reflect the wrong hostname

/local/mongo/bin/mongo
MongoDB shell version: 1.8.1
connecting to: test
> use CL
switched to CL
> other = new Mongo("node401:27017").getDB("CL")
CL
Set401:PRIMARY>

The prompt is now reflecting the set and node connected through the new Mongo object, rather than the node its actually connected.

Solution:
Reset the prompt only when the shell is connect to a new node, not when a Mongo object is created as assigned to a variable.

Business Case:

  • usability
    Very easy to get confused if the prompt is incorrectly reporting the node you are connected to.


 Comments   
Comment by Daniel Pasette (Inactive) [ 15/May/15 ]

this was fixed at some point after v1.8

Comment by Alvin Richards (Inactive) [ 20/May/11 ]

I would say that the prompt should reflect where the default commands go to.

In this example if you execute db.foo.count() is executed against the node that your first connected to. To use the other connection you need to change syntax to do other.foo.count();

The prompt should reflect what the default db... is connect to.

Comment by Eliot Horowitz (Inactive) [ 20/May/11 ]

unclear to me which is correct.
you're connected to both, so right now we're displaying the last mongo we talked to

Generated at Thu Feb 08 03:02:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.