OS Manuals

/usr/bin/mongoimport

Tools for MongoDB (FIPS)

From mongo-tools-fips 100.20.1-r0 (enterprise-packages), captured 2026-11-09 by running mongoimport --help (exit 0). permalink

Usage:
  mongoimport <options> <connection-string> <file>

Import CSV, TSV or JSON data into MongoDB. If no file is provided, mongoimport reads from stdin.

Connection strings must begin with mongodb:// or mongodb+srv://.

See http://docs.mongodb.com/database-tools/mongoimport/ for more information.

general options:
      --help                                      print usage
      --version                                   print the tool version and
                                                  exit
      --config=                                   path to a configuration file

verbosity options:
  -v, --verbose=<level>                           more detailed log output
                                                  (include multiple times for
                                                  more verbosity, e.g. -vvvvv,
                                                  or specify a numeric value,
                                                  e.g. --verbose=N)
      --quiet                                     hide all log output

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)

ssl options:
      --ssl                                       connect to a mongod or mongos
                                                  that has ssl enabled
      --sslCAFile=<filename>                      the .pem file containing the
                                                  root certificate chain from
                                                  the certificate authority
      --sslPEMKeyFile=<filename>                  the .pem file containing the
                                                  certificate and key
      --sslPEMKeyPassword=<password>              the password to decrypt the
                                                  sslPEMKeyFile, if necessary
      --sslCRLFile=<filename>                     the .pem file containing the
                                                  certificate revocation list
      --sslFIPSMode                               use FIPS mode of the
                                                  installed openssl library
      --tlsInsecure                               bypass the validation for
                                                  server's certificate chain
                                                  and host name

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
      --awsSessionToken=<aws-session-token>       session token to authenticate
                                                  via AWS IAM

kerberos options:
      --gssapiServiceName=<service-name>          service name to use when
                                                  authenticating using
                                                  GSSAPI/Kerberos (default:
                                                  mongodb)
      --gssapiHostName=<host-name>                hostname to use when
                                                  authenticating using
                                                  GSSAPI/Kerberos (default:
                                                  <remote server's address>)

namespace options:
  -d, --db=<database-name>                        database to use
  -c, --collection=<collection-name>              collection to use

uri options:
      --uri=mongodb-uri                           mongodb uri connection string

input options:
  -f, --fields=<field>[,<field>]*                 comma separated list of
                                                  fields, e.g. -f name,age
      --fieldFile=<filename>                      file with field names - 1 per
                                                  line
      --file=<filename>                           file to import from; if not
                                                  specified, stdin is used
      --headerline                                use first line in input
                                                  source as the field list (CSV
                                                  and TSV only)
      --jsonArray                                 treat input source as a JSON
                                                  array
      --parseGrace=<grace>                        controls behavior when type
                                                  coercion fails - one of:
                                                  autoCast, skipField, skipRow,
                                                  stop (default: stop)
      --type=<type>                               input format to import: json,
                                                  csv, or tsv
      --columnsHaveTypes                          indicates that the field list
                                                  (from --fields, --fieldsFile,
                                                  or --headerline) specifies
                                                  types; They must be in the
                                                  form of
                                                  '<colName>.<type>(<arg>)'.
                                                  The type can be one of: auto,
                                                  binary, boolean, date,
                                                  date_go, date_ms,
                                                  date_oracle, decimal, double,
                                                  int32, int64, string. For
                                                  each of the date types, the
                                                  argument is a datetime layout
                                                  string. For the binary type,
                                                  the argument can be one of:
                                                  base32, base64, hex. All
                                                  other types take an empty
                                                  argument. Only valid for CSV
                                                  and TSV imports. e.g.
                                                  zipcode.string(),
                                                  thumbnail.binary(base64)
      --legacy                                    use the legacy extended JSON
                                                  format
      --useArrayIndexFields                       indicates that field names
                                                  may include array indexes
                                                  that should be used to
                                                  construct arrays during
                                                  import (e.g. foo.0,foo.1).
                                                  Indexes must start from 0 and
                                                  increase sequentially
                                                  (foo.1,foo.0 would fail).

ingest options:
      --drop                                      drop collection before
                                                  inserting documents
      --ignoreBlanks                              ignore fields with empty
                                                  values in CSV and TSV
      --maintainInsertionOrder                    insert the documents in the
                                                  order of their appearance in
                                                  the input source. By default
                                                  the insertions will be
                                                  performed in an arbitrary
                                                  order. Setting this flag also
                                                  enables the behavior of
                                                  --stopOnError and restricts
                                                  NumInsertionWorkers to 1.
  -j, --numInsertionWorkers=<number>              number of insert operations
                                                  to run concurrently
      --stopOnError                               halt after encountering any
                                                  error during importing. By
                                                  default, mongoimport will
                                                  attempt to continue through
                                                  document validation and
                                                  DuplicateKey errors, but with
                                                  this option enabled, the tool
                                                  will stop instead. A small
                                                  number of documents may be
                                                  inserted after encountering
                                                  an error even with this
                                                  option enabled; use
                                                  --maintainInsertionOrder to
                                                  halt immediately after an
                                                  error
      --mode=[insert|upsert|merge|delete]         insert: insert only, skips
                                                  matching documents. upsert:
                                                  insert new documents or
                                                  replace existing documents.
                                                  merge: insert new documents
                                                  or modify existing documents.
                                                  delete: deletes matching
                                                  documents only. If upsert
                                                  fields match more than one
                                                  document, only one document
                                                  is deleted. (default: insert)
      --upsertFields=<field>[,<field>]*           comma-separated fields for
                                                  the query part when --mode is
                                                  set to upsert or merge
      --writeConcern=<write-concern-specifier>    write concern options e.g.
                                                  --writeConcern majority,
                                                  --writeConcern '{w: 3,
                                                  wtimeout: 500, fsync: true,
                                                  j: true}'
      --bypassDocumentValidation                  bypass document validation
Options (43)
OptionDescriptionSource
--helpprint usagehelp
--versionprint the tool version and exithelp
--configpath to a configuration filehelp
-v, --verbose levelmore detailed log output (include multiple times for more verbosity, e.g. -vvvvv, or specify a numeric value, e.g. --verbose=N)help
--quiethide all log outputhelp
-h, --host hostnamemongodb host to connect to (setname/host1,host2 for replica sets)help
--port portserver port (can also usehelp
--sslconnect to a mongod or mongos that has ssl enabledhelp
--sslCAFile filenamethe .pem file containing the root certificate chain from the certificate authorityhelp
--sslPEMKeyFile filenamethe .pem file containing the certificate and keyhelp
--sslPEMKeyPassword passwordthe password to decrypt the sslPEMKeyFile, if necessaryhelp
--sslCRLFile filenamethe .pem file containing the certificate revocation listhelp
--sslFIPSModeuse FIPS mode of the installed openssl libraryhelp
--tlsInsecurebypass the validation for server's certificate chain and host namehelp
-u, --username usernameusername for authenticationhelp
-p, --password passwordpassword for authenticationhelp
--authenticationDatabase database-namedatabase that holds the user's credentialshelp
--authenticationMechanism mechanismauthentication mechanism to usehelp
--awsSessionToken aws-session-tokensession token to authenticate via AWS IAMhelp
--gssapiServiceName service-nameservice name to use when authenticating using GSSAPI/Kerberos (default: mongodb)help
--gssapiHostName host-namehostname to use when authenticating using GSSAPI/Kerberos (default: <remote server's address>)help
-d, --db database-namedatabase to usehelp
-c, --collection collection-namecollection to usehelp
--uri mongodb-urimongodb uri connection stringhelp
-f, --fields fieldcomma separated list of fields, e.g. -f name,agehelp
--fieldFile filenamefile with field names - 1 per linehelp
--file filenamefile to import from;help
--headerlineuse first line in input source as the field list (CSV and TSV only)help
--jsonArraytreat input source as a JSON arrayhelp
--parseGrace gracecontrols behavior when type coercion fails - one of: autoCast, skipField, skipRow, stop (default: stop)help
--type typeinput format to import: json, csv, or tsvhelp
--columnsHaveTypesindicates that the field list (from --fields, --fieldsFile, or --headerline) specifies types;help
--legacyuse the legacy extended JSON formathelp
--useArrayIndexFieldsindicates that field names may include array indexes that should be used to construct arrays during import (e.g. foo.0,foo.1).help
--dropdrop collection before inserting documentshelp
--ignoreBlanksignore fields with empty values in CSV and TSVhelp
--maintainInsertionOrderinsert the documents in the order of their appearance in the input source.help
-j, --numInsertionWorkers numbernumber of insert operations to run concurrentlyhelp
--stopOnErrorhalt after encountering any error during importing.help
--mode insert|upsert|merge|deleteinsert: insert only, skips matching documents.help
--upsertFields fieldcomma-separated fields for the query part when --mode is set to upsert or mergehelp
--writeConcern write-concern-specifierwrite concern options e.g.help
--bypassDocumentValidationbypass document validationhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.