This is in ~/.dbshell for Mac, etc.
2 Answers
A .dbshell
gets created in whichever the current directory is and there is no single, global .dbshell
as it'd be under a unix based system.
TLDR:
I installed mongodb on my Windows VM out of curiosity for an answer, and ran a few commands while in the bin
folder of the installation. I saw a .dbshell
in the bin
folder which had all the commands I used in it. Then I went to c:\temp
and gave the full path of the mongo shell, and ran a few commands there. I noticed a .dbshell
created in c:\temp
after exiting, which had the history of the commands while I was in that folder.

- 7,679
- 26
- 30
.dbshell file for certain Mongo releases (2.0.x) is created in the directory mongo.exe was executed from on shell exit as lobster1234 mentioned. So, they can be scattered in different directories
This is fixed in future releases to be USER_PROFILE env which typically is C:\Documents and Settings\
Checkin: https://github.com/mongodb/mongo/commit/6d573a9a6e2de66241be53f5eef6873ae2cc12f6

- 365
- 1
- 4
- 8