Created
February 28, 2014 06:40
-
-
Save scien/9266469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> mongoimport --help | |
Import CSV, TSV or JSON data into MongoDB. | |
When importing JSON documents, each document must be a separate line of the input file. | |
Example: | |
mongoimport --host myhost --db my_cms --collection docs < mydocfile.json | |
options: | |
--help produce help message | |
-v [ --verbose ] be more verbose (include multiple times | |
for more verbosity e.g. -vvvvv) | |
--version print the program's version and exit | |
-h [ --host ] arg mongo host to connect to ( <set | |
name>/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 | |
--authenticationDatabase arg user source (defaults to dbname) | |
--authenticationMechanism arg (=MONGODB-CR) | |
authentication mechanism | |
--dbpath arg directly access mongod database files | |
in the given path, instead of | |
connecting to a mongod server - needs | |
to lock the data directory, so cannot | |
be used if a mongod is currently | |
accessing the same path | |
--directoryperdb each db is in a separate directly | |
(relevant only if dbpath specified) | |
--journal enable journaling (relevant only if | |
dbpath specified) | |
-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 first line in input file is a header | |
(CSV and TSV only) | |
--upsert insert or update objects that already | |
exist | |
--upsertFields arg comma-separated fields for the query | |
part of the upsert. 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. Currently limited to 16MB. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment