mongodump と mongorestore で --help してみると
$ mongodump --help
options:
--help produce help message
-h [ --host ] arg mongo host to connect to ("left,right" for pairs)
-d [ --db ] arg database to use
-c [ --collection ] arg collection to use (some commands)
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod data files in this path,
instead of connecting to a mongod instance
--directoryperdb if dbpath specified, each db is in a separate
directory
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
-o [ --out ] arg (=dump) output directory
という感じでポート指定に関する記述が無いんだけど、同一PCで複数の mongod プロセスを走らせている時とかにポートを指定できないのは困る。
そんな時は強引に
$ mongodump -h localhost:27018
とかするとポート指定でダンプやリストアをすることができる。mongoimport/mongoexport も同じかな。後で試してみる。