mongoimport
Import data from a JSON, CSV, or TSV file into a MongoDB instance
Options
Name | Description |
---|---|
--help | Returns information on the options and use of mongoimport |
--verbose, -v | Increases the amount of internal reporting returned on standard output or in log files |
--quiet | Runs mongoimport in a quiet mode that attempts to limit the amount of output |
--version | Returns the mongoimport release number |
--config <filename> | Specifies the full path to a YAML configuration file containing sensitive values for the following options to mongoimport |
--uri <connectionString> | Specifies the resolvable URI connection string of the MongoDB deployment |
--host, -h <hostname:port> | Specifies the resolvable hostname of the MongoDB deployment |
--port <port> | Specifies the TCP port on which the MongoDB instance listens for client connections |
--ssl | Enables connection to a mongod or mongos that has TLS/SSL support enabled |
--sslCAFile <filename> | Specifies the .pem file that contains the root certificate chain from the Certificate Authority |
--sslPEMKeyFile <filename> | Specifies the .pem file that contains both the TLS/SSL certificate and key |
--sslPEMKeyPassword <value> | Specifies the password to de-crypt the certificate-key file (i.e. --sslPEMKeyFile) |
--sslCRLFile <filename> | Specifies the .pem file that contains the Certificate Revocation List |
--sslAllowInvalidCertificates | Bypasses the validation checks for server certificates and allows the use of invalid certificates |
--sslAllowInvalidHostnames | Disables the validation of the hostnames in TLS/SSL certificates |
--username, -u <username> | Specifies a username with which to authenticate to a MongoDB database that uses authentication |
--password, -p <password> | Specifies a password with which to authenticate to a MongoDB database that uses authentication |
--awsSessionToken <AWS Session Token> | Specifies the session token for MONGODB-AWS authentication mechanism |
--authenticationDatabase <dbname> | Specifies the authentication database where the specified --username has been created |
--authenticationMechanism <name> | Specifies the authentication mechanism the mongoimport instance uses to authenticate to the mongod or mongos |
--gssapiServiceName <serviceName> | Specify the name of the service using GSSAPI/Kerberos. This option is available only in MongoDB Enterprise |
--gssapiHostName <hostname> | Specify the hostname of the service using GSSAPI/Kerberos. This option is available only in MongoDB Enterprise |
--db, -d <database> | Specifies the name of the database on which to run the mongoimport |
--collection, -c <collection> | Specifies the name of the collection to import |
--fields, -f <field1,field2,...> | Specify a comma separated list of field names when importing CSV or TSV files that do not have field names in the first (i.e. header) line of the file |
--fieldFile <filename> | Specify a file containing a comma separated list of field names when importing CSV or TSV files that do not have field names in the first (i.e. header) line of the file |
--ignoreBlanks | Ignores empty fields in CSV and TSV exports |
--type <type> | Specifies the file type to import |
--file <filename> | Specifies the location and name of a file containing the data to import |
--drop | Modifies the import process so that the target instance drops the collection before importing the data from the input |
--headerline | Treats the first line of the input file as a header line |
--useArrayIndexFields | Interpret natural numbers in fields as array indexes when importing CSV or TSV files |
--mode <mode> | Specifies how the import process should handle existing documents in the database that match documents in the import file |
--upsertFields <field1,field2,...> | Specifies a list of fields for the query portion of the import process |
--stopOnError | Forces mongoimport to halt the insert operation at the first error rather than continuing the operation despite errors |
jsonArray | Accepts the import of data expressed with multiple MongoDB documents within a single JSON array |
--legacy | Indicates that the import data is in Extended JSON v1 format |
--maintainInsertionOrder | Maintains the order of documents in the import file when inserting documents into the database |
--numInsertionWorkers <number> | Specifies the number of insertion workers to run concurrently |
--writeConcern <document> | Specifies the write concern for each write operation that mongoimport performs |
--bypassDocumentValidation | Enables mongoimport to bypass document validation during the operation |
--columnsHaveTypes | Instructs mongoimport that the field list specified in --fields, --fieldFile, or --headerline specifies the types of each field |
--parseGrace <grace> | Specifies how mongoimport handles type coercion failures when importing CSV or TSV files with --columnsHaveTypes |