2011-04-22 54 views
29

MongoDB有類似.bash_history文件嗎?MongoDB有一個shell歷史文件嗎?

我最近輸入了一個長命令,關閉了&重新打開了shell,並想檢索它。

按下不起作用,因爲看起來最後一個shell的歷史記錄在新shell中無法訪問。

我用自制軟件安裝了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 
+0

它應該已經開啓。你檢查過你是否有〜/ .dbshel​​l? – lobster1234 2011-04-22 22:11:09

回答

34

是,它在~/.dbshell爲1.8.1版本,我使用。但是這可能是他們在1.7+中添加的東西,因爲我記得1.6.5沒有它。

+0

謝謝!閱讀您的答案後,請參閱我在問題中添加的修改。 – ma11hew28 2011-04-22 14:39:31

0

當然是的,

它在你的home路徑:~/.dbshell像lobster1234說。 窗戶,你應該檢查出的鏈接https://docs.mongodb.com/manual/reference/program/mongo/#files

但要注意,你應該保存的內容在其他文件(cat .dbshell >>Mongohistory.txt)你已經使用蒙戈外殼後,becouse MongoDB的外殼沒有敢拿保存您在已錄製的全commandes。