Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does MongoDB have a shell history file?

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 
like image 617
ma11hew28 Avatar asked Apr 22 '11 02:04

ma11hew28


People also ask

Where can I find MongoDB shell?

Find() Method. In MongoDB, find() method is used to select documents in a collection and return a cursor to the selected documents. Cursor means a pointer that points to a document, when we use find() method it returns a pointer on the selected documents and returns one by one.

Where are MongoDB logs?

MongoDB logs can be found in the MongoDB log files at /var/log/mongodb/mongodb. log. If you can't find the log files from this location, you can check the mongodb.

How do I show all collections in MongoDB shell?

To list all collections in Mongo shell, you can use the function getCollectionNames().


1 Answers

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.

like image 87
lobster1234 Avatar answered Sep 22 '22 21:09

lobster1234