mongodump的官方說明(可通過mongodump --help查看):
options:--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( /s1,s2 forsets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting to a mongod server -needs to lock the data directory, so cannot be usedif a mongod is currently accessing the same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collection to use (some commands)-o [ --out ] arg (=dump) output directory or "-" for stdout-q [ --query ] arg json query--oplog Use oplog for point-in-time snapshotting--repair try to recover a crashed database--forceTableScan force a table scan (do not use $snapshot)
mongorestore的官方說明(可通過mongorestore --help查看):
options:--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( /s1,s2 for sets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting to a mongod server -needs to lock the data directory, so cannot be usedif a mongod is currently accessing the same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collection to use (some commands)--objcheck validate object before inserting--filter arg filter to apply before inserting--drop drop each collection before import--oplogReplay replay oplog for point-in-time restore--oplogLimit arg exclude oplog entries newer than provided timestamp(epoch[:ordinal])--keepIndexVersion don't upgrade indexes to newest version--noOptionsRestore don't restore collection options--noIndexRestore don't restore indexes--w arg (=1) minimum number of replicas per write
mongoexport的官方說明(可通過mongoexport --help查看):--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( /s1,s2 forsets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting to a mongod server -needs to lock the data directory, so cannot be usedif a mongod is currently accessing the same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collection to use (some commands)-f [ --fields ] arg comma separated list of field names e.g. -fname,age--fieldFile arg file with fields names - 1 per line-q [ --query ] arg query filter, as a JSON string--csv export to csv instead of json-o [ --out ] arg output file; if not specified, stdout is used--jsonArray output to a json array rather than one object perline-k [ --slaveOk ] arg (=1) use secondaries for export if available, defaulttrue--forceTableScan force a table scan (do not use $snapshot)
mongoimport的官方說明(可通過mongoimport --help查看):--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( /s1,s2 for sets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting to a mongod server -needs to lock the data directory, so cannot be usedif a mongod is currently accessing the same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collection to use (some commands)-f [ --fields ] arg comma separated list of field names e.g. -f name,age--fieldFile arg file with fields names - 1 per line--ignoreBlanks if given, empty fields in csv and tsv will be ignored--type arg type of file to import. default: json (json,csv,tsv)--file arg file to import from; if not specified stdin is used--drop drop collection first--headerline CSV,TSV only - use first line as headers--upsert insert or update objects that already exist--upsertFields arg comma-separated fields for the query part of theupsert. You should make sure this is indexed--stopOnError stop importing at first error rather than continuing--jsonArray load a json array, not one item per line. Currentlylimited to 16MB.