MongoDB 有 shell 历史文件吗?
MongoDB 有类似 .bash_history
文件吗?
我最近输入了一个很长的命令, close &重新打开shell,想找回它。
按向上键不起作用,因为似乎在新 shell 中无法访问上一个 shell 的历史记录。
我用 Homebrew 安装了 1.8.1。我是否应该设置一个配置变量来打开 MongoDB 交互式 shell 历史记录?
这是我的 mongod.conf 文件:
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Only accept local connections
bind_ip = 127.0.0.1
# Enable Write Ahead Logging (not enabled by default in production deployments)
journal = true
Does MongoDB have something like a .bash_history
file?
I recently typed in a long command, closed & re-opened the shell, and want to retrieve it.
Pressing up doesn't work as it seems that the history of the last shell is not accessible in the new shell.
I installed 1.8.1 with Homebrew. Is there a configuration variable I should set that will turn on MongoDB interactive shell history logging?
Here's my mongod.conf
file:
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Only accept local connections
bind_ip = 127.0.0.1
# Enable Write Ahead Logging (not enabled by default in production deployments)
journal = true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,它位于我正在使用的 1.8.1 版本中的
~/.dbshell
中。但这可能是他们在 1.7+ 中添加的东西,因为我记得 1.6.5 没有它。Yes, its in
~/.dbshell
as of version 1.8.1 which I am using. But this could be something they added in 1.7+ as from what I recall 1.6.5 does not have it.当然是的,
它在你的主路径中:
~/.dbshell
,就像 lobster1234 所说的那样。对于 Windows,您应该查看链接 https://docs.mongodb.com /manual/reference/program/mongo/#files
但要注意,使用后您应该将内容保存在其他文件
(cat .dbshell >>Mongohistory.txt)
中mongo shell,因为 mongodb shell 不会保存您录制的整个命令。of course yes,
it's in your home Path :
~/.dbshell
like lobster1234 said.for windows you should check out the link https://docs.mongodb.com/manual/reference/program/mongo/#files
but beware, you should save the contents in other file
(cat .dbshell >>Mongohistory.txt)
after you have used mongo shell, becouse mongodb shell don't ganna save the whole commandes that you have taped in.对于 Windows,请在 powershell 中键入以下内容:
For windows, type the following in the powershell:
在 Windows
cmd
上,您可以键入以下命令来查看历史记录:如果您安装了 VS code,这也有效:
On Windows
cmd
you can type this command to see the history:If you have VS code installed, this also works: