从数据库 dataname 中查找 datasheet 这个表,输出到E:\data\name_json.dat
mongoexport -d dataname -c datasheet -o E:\data\name_json.dat
从数据库 dataname 中查找 datasheet 这个表中 isDeleted : false 的数据
mongoexport -d dataname -c datasheet --type=json -q"{isDeleted : false}" -o E:\data\name_json.dat
从数据库 dataname 中查找 datasheet 这个表中 isDeleted : false 的数据,并讲 savesheet 这个表的数据保存
mongoexport -d dataname -c datasheet --type=json -q"{"isDeleted" : false}" -f savesheet -o E:\data\name_json.dat
参数说明:
connection options: -h, --host=<hostname> mongodb host to connect to (setname/host1,host2 for replica sets) --port=<port> server port (can also use --host hostname:port) library authentication options: -u, --username=<username> username for authentication -p, --password=<password> password for authentication --authenticationDatabase=<database-name> database that holds the user's credentials --authenticationMechanism=<mechanism> authentication mechanism to use namespace options: -d, --db=<database-name> database to use -c, --collection=<collection-name> collection to use output options: -f, --fields=<field>[,<field>]* comma separated list of field names (required for exporting CSV) e.g. -f "name,age" --fieldFile=<filename> file with field names - 1 per line --type=<type> the output format, either json or csv (defaults to 'json') (default: json) -o, --out=<filename> output file; if not specified, stdout is used --jsonArray output to a JSON array rather than one object per line --pretty output JSON formatted to be human-readable --noHeaderLine export CSV data without a list of field names at the first line querying options: -q, --query=<json> query filter, as a JSON string, e.g., '{x:{$gt:1}}' --queryFile=<filename> path to a file containing a query filter (JSON) -k, --slaveOk allow secondary reads if available (default true) (default: false) --readPreference=<string>|<json> specify either a preference name or a preference json object --forceTableScan force a table scan (do not use $snapshot) --skip=<count> number of documents to skip --limit=<count> limit the number of documents to export --sort=<json> sort order, as a JSON string, e.g. '{x:1}' --assertExists if specified, export fails if the collection does not exist (default: false)