Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear the command history in the mongo shell

Is there a command to clear the history from within the mongo shell?

like image 267
ABCoder Avatar asked Jan 26 '11 19:01

ABCoder


People also ask

How do I get out of Mongo shell?

Note: Instead of typing the exit command, an alternative way to close the shell is to press CTRL + C instead. Now try reconnecting the MongoDB shell to the database server, but this time provide a username and password to properly authenticate into your MongoDB instance.

What is the command used to launch the Mongo shell?

Connect to MongoDB database You can start the server in CMD using the following command. Then type mongo command to run the shell. Now you are in the Mongo shell. If you want, you can run the mongo and mongod without the command prompt.


2 Answers

There should be a file called .dbshell in your home folder. Just delete it.

like image 150
Kyle Banker Avatar answered Oct 15 '22 03:10

Kyle Banker


MongoDB terminal history is stored inside the ~/.dbshellfile. Just empty the .dbshell file

 $ > ~/.dbshell

Versions of Windows mongo.exe earlier than 2.2.0 will save the .dbshell file in the mongo.exe working directory.

like image 43
Fizer Khan Avatar answered Oct 15 '22 01:10

Fizer Khan