【发布时间】:2011-06-16 01:55:29
【问题描述】:
是否有从 mongo shell 中清除历史记录的命令?
【问题讨论】:
标签: mongodb mongo-shell
是否有从 mongo shell 中清除历史记录的命令?
【问题讨论】:
标签: mongodb mongo-shell
您的主文件夹中应该有一个名为 .dbshell 的文件。删掉就好了。
【讨论】:
可以通过Ctrl+L清除shell上的内容
【讨论】:
MongoDB 终端历史存储在~/.dbshellfile 中。只需清空.dbshell 文件
$ > ~/.dbshell
2.2.0 之前的 Windows mongo.exe 版本会将 .dbshell 文件保存在 mongo.exe 工作目录中。
【讨论】:
命令历史存储在 ~/.dbshell 文件中。
例如,在类 Unix 系统上:
# Ensure an empty history file
echo "" > ~/.dbshell
# Remove rwx access to the history file
chmod 0 ~/.dbshell
【讨论】:
如果您将 MongoDB Shell 作为独立包使用,您会在 ~/.dbshell 中找到 shell 历史文件
如果您在 MongoDB Compass 中使用嵌入式 MongoDB Shell,您会发现位于 ~/.config/MongoDB Compass/MongoDB Compass/shell-history.json
清空历史文件
【讨论】: