Is it possible to specify a directory/folder for mongodump?

ericsoco picture ericsoco · Apr 12, 2012 · Viewed 25.3k times · Source

I'd like to specify the directory to which mongodump dumps, via a switch on the mongodump command. Is this possible?

Answer

Justin Jenkins picture Justin Jenkins · Apr 12, 2012

You don't need a script. From the docs:

--out <path>, -o <path>

Specifies the directory where mongodump will write BSON files for the dumped databases.

Example:

mongodump -o /mydir/

Lots of other options there, check it out.