0

I know mongod --dbpath <mypath> will assign the directory. Is there a quick command-line way to spit out its path?

After all my data were supposedly migrated to a new laptop from my old one, I'm just trying to plug back into that old directory. I don't remember if it was /data/db or somewhere custom, but when I got the machine back, there was no /data/db.

Right now, when I try to start this new mongo installation I get:

I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
I CONTROL  [initandlisten] dbexit:  rc: 100

I didn't have a mongo.conf file before, but if there's no way to discover the old directory, seems like I should make one now, if for no other reason than to have a record of it.

Kinda hard to believe there's not a simple command or environment variable or something for this.

parisminton
  • 401
  • 1
  • 6
  • 13
  • You can use http://docs.mongodb.org/manual/reference/command/getCmdLineOpts/ but I am sure this is a dupe – Sammaye May 05 '15 at 21:09
  • What O/S are you using and how did you install MongoDB? If you have a running MongoDB instance on the old computer you can find the dbpath in the shell with `db.serverCmdLineOpts()`. If you want to try to find the directory on your new computer, search for `local.ns` .. this is the namespace file for the `local` database which should be created by default for MongoDB 2.4+. The default `dbpath` for MongoDB is always `/data/db`, and `mongod` does not look for a config file (one has to be specified via command-line or service configuration). – Stennie May 10 '15 at 07:30

0 Answers0