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

28,057

Solution 1

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.

Solution 2

You can view all the commands for mongodump by typing "mongodump --help" in the command prompt (NB. You have to be in the folder that contains mongodump.exe).

You can use a command like:

mongodump /host <hostIP> /port <port> /d <database> /c <collection> /o <outputDirectoryPath> 
Share:
28,057
ericsoco
Author by

ericsoco

once an architect, reborn as a coder/artist/interaction designer. now developing exhibits for san francisco's exploratorium. and still learning.

Updated on July 09, 2022

Comments

  • ericsoco
    ericsoco almost 2 years

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