I've recently re-installed Mongodb switching from the enterprise to the community version. Nevertheless, when I start mongo
, this is the prompt format I get:
MongoDB Enterprise >
How can I change it to the standard prompt version? (i.e., >
if I am not wrong)
You can change the prompt from within a shell session by setting the prompt
variable. For example, issuing the following command within a Mongo shell ...
var prompt="this_prompt >"
... will result in the shell's prompt changing to:
this_prompt >
You can change the default prompt for all future sessions by updating your .mongorc.js
(you'll find this in your $HOME directory and if it does not exist then just create it). The following addition to your .mongorc.js
...
var prompt=function() {
return ISODate().toLocaleTimeString() + " > ";
}
... will result in this prompt:
:~/dev/tools/mongodb/mongodb-osx-x86_64-3.4.7/bin$ ./mongo
MongoDB shell version v3.4.7
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.7
16:09:43 >
16:09:57 >
Or, to get this prompt: >
just add the following to your .mongorc.js
:
var prompt=">"
There remains the sub text to your question, namely; where is the existing MongoDB Enterprise >
prompt coming from?. It's hard to say but ...
mongorc.js
; have a look in /etc/mongorc.js
if you are on a *nix system or %ProgramData%\MongoDB
if you are on Windows