mongoexport(1) - Linux man page

Name

mongoexport - the Mongo export tool

Synopsis

mongoexport [OPTIONS]

Description

mongoexport is a tool to export a MongoDB collection to either JSON or CSV. The query can be filtered or a list of fields to output can be given.

If the output is CSV, the fields must be specified in order.

Examples

mongoexport -d test -c test1 --csv -f name,num

export documents from test.test1 in CSV format

Options

--help

show usage information

--version
show version information
-v, --verbose
be more verbose (include multiple times for more verbosity e.g. -vvvvv)
-h, --host HOST
server to connect to (default HOST=localhost)
-port arg
server port. Can also use --host hostname:port
--ipv6

enable IPv6 support (disabled by default)

-u|--username USERNAME
specify user to log in as
-p|--password PASSWORD
specify password of user
--dbpath PATH
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
-d, --db DATABASE
database to use
-c, --c COLLECTION
collection to use
-f, --fields FIELDS
comma-separated list of field names
--fieldFile FILE
file with fields names - 1 per line
--query
JSON query filter
--csv

export to CSV instead of JSON

-o, --out FILE
output file, if not specified, stdout is used

Copyright

Copyright 2007-2011 10gen

See Also

For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org.

Author

Kristina Chodorow