Is there a command to clear the history from within the 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.
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.
There should be a file called .dbshell in your home folder. Just delete it.
MongoDB terminal history is stored inside the ~/.dbshell
file. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With