diff options
author | Andrew Morrow <andrew.morrow@10gen.com> | 2020-01-15 19:51:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-15 19:51:39 +0000 |
commit | 3c0c136ecf80d60f512e96b9720af3845f401fd8 (patch) | |
tree | e8981c04b760b03bb623b2cfaf31d48ba84bc9a7 /debian | |
parent | c9dbf657e1ef0fdda8a32d1080d4a7c3bb361c5e (diff) | |
download | mongo-3c0c136ecf80d60f512e96b9720af3845f401fd8.tar.gz |
SERVER-44763 Remove gotools from build and packaging
Diffstat (limited to 'debian')
-rw-r--r-- | debian/bsondump.1 | 200 | ||||
-rw-r--r-- | debian/lintian-overrides | 5 | ||||
-rw-r--r-- | debian/mongodb-enterprise-server.docs | 1 | ||||
-rw-r--r-- | debian/mongodb-enterprise-unstable-server.docs | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | debian/mongodb-enterprise-unstable.rules | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | debian/mongodb-enterprise.rules | 7 | ||||
-rw-r--r-- | debian/mongodb-org-server.docs | 1 | ||||
-rw-r--r-- | debian/mongodb-org-unstable-server.docs | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | debian/mongodb-org-unstable.rules | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | debian/mongodb-org.rules | 7 | ||||
-rw-r--r-- | debian/mongodb-parameters.5 | 2 | ||||
-rw-r--r-- | debian/mongodump.1 | 1356 | ||||
-rw-r--r-- | debian/mongoexport.1 | 1546 | ||||
-rw-r--r-- | debian/mongofiles.1 | 935 | ||||
-rw-r--r-- | debian/mongoimport.1 | 1413 | ||||
-rw-r--r-- | debian/mongoreplay.1 | 1298 | ||||
-rw-r--r-- | debian/mongorestore.1 | 1502 | ||||
-rw-r--r-- | debian/mongostat.1 | 1243 | ||||
-rw-r--r-- | debian/mongotop.1 | 921 |
19 files changed, 5 insertions, 10448 deletions
diff --git a/debian/bsondump.1 b/debian/bsondump.1 deleted file mode 100644 index 93b536585f0..00000000000 --- a/debian/bsondump.1 +++ /dev/null @@ -1,200 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "BSONDUMP" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -bsondump \- MongoDB BSON Utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of \fI\%bsondump\fP\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -The \fI\%bsondump\fP converts BSON files into human\-readable -formats, including JSON\&. For example, \fI\%bsondump\fP is useful -for reading the output files generated by \fBmongodump\fP\&. -.sp -Run \fI\%bsondump\fP from the system command line, not the \fBmongo\fP shell. -.sp -\fBIMPORTANT:\fP -.INDENT 0.0 -.INDENT 3.5 -\fI\%bsondump\fP is a diagnostic tool for inspecting -BSON files, not a tool for data ingestion or other application use. -.UNINDENT -.UNINDENT -.sp -Starting in version 4.2, \fI\%bsondump\fP uses Extended -JSON v2.0 (Canonical mode) -to format its data. -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%bsondump\fP removed the \fB\-\-filter\fP, \fB\-\-dbpath\fP and the -\fB\-\-noobjcheck\fP options. - -.INDENT 0.0 -.TP -.B bsondump -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBbsondump\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBbsondump\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBbsondump\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-objcheck -Validates each BSON object before outputting it in JSON -format. By default, \fBbsondump\fP enables \fI\%\-\-objcheck\fP\&. -For objects with a high degree of sub\-document nesting, -\fI\%\-\-objcheck\fP can have a small impact on performance. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-type <=json|=debug> -Changes the operation of \fBbsondump\fP from outputting -"JSON" (the default) to a debugging format. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-pretty -New in version 3.0.0. - -.sp -Outputs documents in a pretty\-printed format JSON. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-bsonFile -New in version 3.4. - -.sp -Specifies a path to a BSON file to dump to JSON. \fI\%\-\-bsonFile\fP is -an alternative to the positional \fI\%<bsonFilename>\fP option. -.sp -By default, \fBbsondump\fP reads from standard input. -.UNINDENT -.INDENT 0.0 -.TP -.B <bsonFilename> -The final argument to \fBbsondump\fP is a document containing -BSON\&. This data is typically generated by -\fBbsondump\fP or by MongoDB in a rollback operation. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-outFile -New in version 3.4. - -.sp -Specifies the path of the file to which \fBbsondump\fP should write -its output JSON data. -.sp -By default, \fBbsondump\fP writes to standard output. -.UNINDENT -.SH EXAMPLES -.sp -Changed in version 3.4. - -.sp -By default, \fI\%bsondump\fP outputs data to standard output. To -create corresponding JSON files, you can use the -\fI\%\-\-outFile\fP option: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -bsondump \-\-outFile collection.json collection.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Use the following command (at the system shell) to produce debugging -output for a BSON file: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -bsondump \-\-type=debug collection.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/lintian-overrides b/debian/lintian-overrides index f0c59eb8229..216e736c5e1 100644 --- a/debian/lintian-overrides +++ b/debian/lintian-overrides @@ -3,9 +3,4 @@ mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongo /usr/lib64/xulrunner-1.9.1 mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongocryptd /usr/lib64/xulrunner-1.9.1 mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongod /usr/lib64/xulrunner-1.9.1 -mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongodump /usr/lib64/xulrunner-1.9.1 -mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongoexport /usr/lib64/xulrunner-1.9.1 -mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongofiles /usr/lib64/xulrunner-1.9.1 -mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongoimport /usr/lib64/xulrunner-1.9.1 -mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongorestore /usr/lib64/xulrunner-1.9.1 mongodb: binary-or-shlib-defines-rpath ./usr/bin/mongos /usr/lib64/xulrunner-1.9.1 diff --git a/debian/mongodb-enterprise-server.docs b/debian/mongodb-enterprise-server.docs index 3671b46a1ef..923fcdeafce 100644 --- a/debian/mongodb-enterprise-server.docs +++ b/debian/mongodb-enterprise-server.docs @@ -6,5 +6,4 @@ snmp/MONGODBINC-MIB.txt LICENSE-Enterprise.txt README THIRD-PARTY-NOTICES -THIRD-PARTY-NOTICES.gotools MPL-2 diff --git a/debian/mongodb-enterprise-unstable-server.docs b/debian/mongodb-enterprise-unstable-server.docs index 3671b46a1ef..923fcdeafce 100644 --- a/debian/mongodb-enterprise-unstable-server.docs +++ b/debian/mongodb-enterprise-unstable-server.docs @@ -6,5 +6,4 @@ snmp/MONGODBINC-MIB.txt LICENSE-Enterprise.txt README THIRD-PARTY-NOTICES -THIRD-PARTY-NOTICES.gotools MPL-2 diff --git a/debian/mongodb-enterprise-unstable.rules b/debian/mongodb-enterprise-unstable.rules index d7e8924d70e..e5696ecc8db 100644..100755 --- a/debian/mongodb-enterprise-unstable.rules +++ b/debian/mongodb-enterprise-unstable.rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -TOOLS=bsondump mongodecrypt mongodump mongoexport mongofiles mongoimport mongoldap mongorestore mongostat mongotop mongokerberos +TOOLS=mongodecrypt mongoldap mongokerberos # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 @@ -58,11 +58,6 @@ clean: rm -f mongo rm -f mongod rm -f mongocryptd - rm -f mongoimportjson - rm -f mongoexport - rm -f mongorestore - rm -f mongodump - rm -f mongofiles rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a diff --git a/debian/mongodb-enterprise.rules b/debian/mongodb-enterprise.rules index 59ef93495d4..f6bc0f76d60 100644..100755 --- a/debian/mongodb-enterprise.rules +++ b/debian/mongodb-enterprise.rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -TOOLS=bsondump mongodecrypt mongodump mongoexport mongofiles mongoimport mongoldap mongorestore mongostat mongotop mongokerberos +TOOLS=mongodecrypt mongoldap mongokerberos # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 @@ -56,12 +56,7 @@ clean: rm -f config.log rm -f mongo rm -f mongod - rm -f mongoimportjson rm -f mongocryptd - rm -f mongoexport - rm -f mongorestore - rm -f mongodump - rm -f mongofiles rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a diff --git a/debian/mongodb-org-server.docs b/debian/mongodb-org-server.docs index 7692ac510de..a280026b6f9 100644 --- a/debian/mongodb-org-server.docs +++ b/debian/mongodb-org-server.docs @@ -1,5 +1,4 @@ LICENSE-Community.txt README THIRD-PARTY-NOTICES -THIRD-PARTY-NOTICES.gotools MPL-2 diff --git a/debian/mongodb-org-unstable-server.docs b/debian/mongodb-org-unstable-server.docs index 7692ac510de..a280026b6f9 100644 --- a/debian/mongodb-org-unstable-server.docs +++ b/debian/mongodb-org-unstable-server.docs @@ -1,5 +1,4 @@ LICENSE-Community.txt README THIRD-PARTY-NOTICES -THIRD-PARTY-NOTICES.gotools MPL-2 diff --git a/debian/mongodb-org-unstable.rules b/debian/mongodb-org-unstable.rules index 8028d7a37a5..593f5c7a21f 100644..100755 --- a/debian/mongodb-org-unstable.rules +++ b/debian/mongodb-org-unstable.rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -TOOLS=bsondump mongodump mongoexport mongofiles mongoimport mongorestore mongostat mongotop +TOOLS= # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 @@ -53,11 +53,6 @@ clean: rm -f config.log rm -f mongo rm -f mongod - rm -f mongoimportjson - rm -f mongoexport - rm -f mongorestore - rm -f mongodump - rm -f mongofiles rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a diff --git a/debian/mongodb-org.rules b/debian/mongodb-org.rules index 4b75067212a..adf57f44451 100644..100755 --- a/debian/mongodb-org.rules +++ b/debian/mongodb-org.rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -TOOLS=bsondump mongodump mongoexport mongofiles mongoimport mongorestore mongostat mongotop +TOOLS= # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 @@ -52,11 +52,6 @@ clean: rm -f config.log rm -f mongo rm -f mongod - rm -f mongoimportjson - rm -f mongoexport - rm -f mongorestore - rm -f mongodump - rm -f mongofiles rm -f install_compass rm -f .sconsign.dblite rm -f libmongoclient.a diff --git a/debian/mongodb-parameters.5 b/debian/mongodb-parameters.5 index 52264008606..f4bc67dc5cd 100644 --- a/debian/mongodb-parameters.5 +++ b/debian/mongodb-parameters.5 @@ -1103,7 +1103,7 @@ To detect unindexed queries without \fBnotablescan\fP, consider reading the /tutorial/evaluate\-operation\-performance and /tutorial/optimize\-query\-performance\-with\-indexes\-and\-projections sections and using the \fI\%logLevel\fP parameter, -/reference/program/mongostat and profiling\&. +the mongostat tool, and profiling\&. .sp Don\(aqt run production \fBmongod\fP instances with \fI\%notablescan\fP because preventing collection scans can potentially diff --git a/debian/mongodump.1 b/debian/mongodump.1 deleted file mode 100644 index 2463ce09767..00000000000 --- a/debian/mongodump.1 +++ /dev/null @@ -1,1356 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGODUMP" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongodump \- MongoDB Data Dump Utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Usage in Backup Strategy\fP -.IP \(bu 2 -\fI\%Syntax\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongodump\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -\fI\%mongodump\fP is a utility for creating a binary export of the -contents of a database. \fI\%mongodump\fP can export data from -either \fBmongod\fP or \fBmongos\fP instances. -.SH USAGE IN BACKUP STRATEGY -.SS Standalones/Replica Sets -.sp -For standalone or a replica set, \fI\%mongodump\fP can be a part -of a backup strategy with -\fBmongorestore\fP for partial backups based on a query, -syncing from production to staging or development environments, or -changing the storage engine of a standalone. -.sp -For an overview of \fI\%mongodump\fP in conjunction with -\fBmongorestore\fP part of a backup and recovery strategy, see: -.INDENT 0.0 -.IP \(bu 2 -/tutorial/backup\-and\-restore\-tools -.IP \(bu 2 -/core/backups -.UNINDENT -.SS Sharded Cluster -.sp -Starting in MongoDB 4.2, \fI\%mongodump\fP and -\fBmongorestore\fP \fBcannot\fP be part of a backup -strategy for sharded clusters. These manual tools do not maintain -the atomicity guarantees of transactions across shards. -.sp -To maintain the atomicity guarantees of transactions across shards, -use the coordinated backup and restore services provided by: -.INDENT 0.0 -.IP \(bu 2 -\fI\%MongoDB Atlas\fP, -.IP \(bu 2 -\fI\%MongoDB Cloud Manager\fP, or -.IP \(bu 2 -\fI\%MongoDB Ops Manager\fP\&. -.UNINDENT -.SH SYNTAX -.sp -Run \fI\%mongodump\fP from the system command line, not the \fBmongo\fP shell. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump [options] -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Connect to a MongoDB Instance -.sp -To connect to a local MongoDB instance running on port 27017 and use -the default settings to export the content, run -\fI\%mongodump\fP without any command\-line options: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To specify a host and/or port of the MongoDB instance, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-uri connection string\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongodb0.example.com:27017" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-host\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "mongodb0.example.com:27017" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-host\fP and \fI\%\-\-port\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "mongodb0.example.com" \-\-port 27017 [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.SS Connect to a Replica Set -.sp -To connect to a replica set to export its data, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the replica set name and members in the \fI\%\-\-uri connection string\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myReplicaSetName" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Specify the replica set name and members in the \fI\%\-\-host\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -By default, \fI\%mongodump\fP reads from the primary of the -replica set. To override the default, you can specify the read -preference: -.INDENT 0.0 -.IP \(bu 2 -You can specify the read preference in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myReplicaSetName&readPreference=secondary" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the read preference tags, include the -\fBreadPreferenceTags\fP option: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -You can specify the read preference in using the -\fI\%\-\-readPreference\fP command\-line -option. The command\-line option takes a string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" \-\-readPreference secondary [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Or, the command\-line option can takes a quote\-enclosed document -\fB\(aq{ mode: <mode>, tagSets: [ <tag1>, ... ], maxStalenessSeconds:<num>}\(aq\fP -to specify the mode, the optional read preference tag -sets, and the optional -maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" \-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ]}\(aq [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.SS Connect to a Sharded Cluster -.sp -To connect to a sharded cluster to export its data, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the hostname of the \fBmongos\fP instance in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongos0.example.com:27017" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Specify the hostname and port of the \fBmongos\fP instance in the \fI\%\-\-host\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "mongos0.example.com:27017" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -By default, \fI\%mongodump\fP reads from the primary of the -shard replica set. To override the default, you can specify the read -preference: -.INDENT 0.0 -.IP \(bu 2 -You can specify the read preference in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongos0.example.com:27017/?readPreference=secondary" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the read preference tags, include the -\fBreadPreferenceTags\fP option: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-uri "mongodb://mongos0.example.com:27017/?readPreference=secondary&readPreferenceTags=region:east" [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -You can specify the read preference in using the -\fI\%\-\-readPreference\fP command\-line -option. The command\-line option takes a string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "mongos0.example.com:27017" \-\-readPreference secondary [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Or, the command\-line option can takes a quote\-enclosed document -\fB\(aq{ mode: <mode>, tagSets: [ <tag1>, ... ], maxStalenessSeconds: <num>}\(aq\fP -to specify the mode, the optional read preference tag -sets, and the optional -maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host "mongos0.example.com:27017" \-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ]}\(aq [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.sp -\fBSEE ALSO:\fP -.INDENT 0.0 -.INDENT 3.5 -\fI\%Examples\fP -.UNINDENT -.UNINDENT -.SH BEHAVIOR -.SS Read Preference -.sp -By default, \fI\%mongodump\fP uses read preference -\fBprimary\fP\&. To override the default, you can specify the -read preference in the -\fI\%\-\-readPreference\fP command\-line -option or in the \fI\%\-\-uri connection string\fP\&. -.sp -Starting in version 4.2, if you specify read preference in the URI -string and the \fI\%\-\-readPreference\fP -option, the \fI\%\-\-readPreference\fP -value overrides the read preference specified in the URI string. -.sp -In earlier versions, the two options are incompatible. -.SS Data Exclusion -.sp -\fI\%mongodump\fP excludes the content of the \fBlocal\fP database in its output. -.sp -\fI\%mongodump\fP output only captures the documents in the -database and does not include index data. \fBmongorestore\fP -or \fBmongod\fP must then rebuild the indexes after restoring -data. -.sp -Changed in version 3.4: MongoDB 3.4 added support for -read\-only views\&. By default, -\fI\%mongodump\fP only captures a view\(aqs metadata: it does not -create a binary export of the documents included in the view. To -capture the documents in a view use \fI\%\-\-viewsAsCollections\fP\&. - -.SS Metadata Format -.sp -Starting in version 4.2, \fI\%mongodump\fP uses Extended -JSON v2.0 (Canonical) format -for the metadata files. To parse these files for restore, use -\fBmongorestore\fP version 4.2+ that supports Extended -JSON v2.0 (Canonical or Relaxed mode) format. -.INDENT 0.0 -.INDENT 3.5 -.SS Tip -.sp -If general, use corresponding versions of \fI\%mongodump\fP -and \fBmongorestore\fP\&. That is, to restore data files -created with a specific version of \fI\%mongodump\fP, use the -corresponding version of \fBmongorestore\fP\&. -.UNINDENT -.UNINDENT -.SS Overwrite Files -.sp -\fI\%mongodump\fP overwrites output files if they exist in the -backup data folder. Before running the \fI\%mongodump\fP command -multiple times, either ensure that you no longer need the files in the -output folder (the default is the \fBdump/\fP folder) or rename the -folders or files. -.SS Data Compression Handling -.sp -When run against a \fBmongod\fP instance that uses the -WiredTiger storage engine, -\fI\%mongodump\fP outputs uncompressed data. -.SS Working Set -.sp -\fI\%mongodump\fP can adversely affect performance of the -\fBmongod\fP\&. If your data is larger than system memory, the -\fI\%mongodump\fP will push the working set out of memory. -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongodump\&. mongodump -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SH REQUIRED ACCESS -.sp -To run \fI\%mongodump\fP against a MongoDB deployment that has -access control enabled, you must have -privileges that grant \fBfind\fP action for each database to -back up. The built\-in \fBbackup\fP role provides the required -privileges to perform backup of any and all databases. -.sp -Changed in version 3.2.1: The \fBbackup\fP role provides additional privileges to back -up the \fBsystem.profile\fP -collection that exists when running with database profiling\&. Previously, users required -\fBread\fP access on this collection. - -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%mongodump\fP removed the \fB\-\-dbpath\fP as well as related -\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. To use -\fI\%mongodump\fP, you must run \fI\%mongodump\fP against a running -\fBmongod\fP or \fBmongos\fP instance as appropriate. - -.INDENT 0.0 -.TP -.B mongodump -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongodump\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongodump\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongodump\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongodump\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, specify the -\fBreplSetName\fP and a seed list of set members, as in -the following: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <replSetName>/<hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When specifying the replica set list format, \fBmongodump\fP always connects to -the primary\&. -.sp -You can also connect to any single member of the replica set by specifying -the host and port of only that member: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongodump\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongodump\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongodump\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongodump\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongodump\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongodump\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.sp -If you do not specify an authentication database, \fBmongodump\fP -assumes that the database specified to export holds the user\(aqs credentials. -.sp -If you do not specify an authentication database or a database to -export, \fBmongodump\fP assumes the \fBadmin\fP database holds the user\(aqs -credentials. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongodump\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-db <database>, \-d <database> -Specifies a database to backup. If you do not specify a database, -\fI\%mongodump\fP copies all databases in this instance into the dump -files. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-db\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collection <collection>, \-c <collection> -Specifies a collection to backup. If you do not specify a collection, -this option copies all collections in the specified database or instance -to the dump files. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-query <json>, \-q <json> -Provides a JSON document as a query that optionally limits -the documents included in the output of \fI\%mongodump\fP\&. To -use the \fB\-\-query\fP option, you must also specify the -\fI\%\-\-collection\fP option. -.sp -You must enclose the query document in single quotes (\fB\(aq{ ... }\(aq\fP) to ensure that it does -not interact with your shell environment. -.sp -Starting in MongoDB 4.2, the query \fBmust\fP be in -Extended JSON v2 format (either relaxed or canonical/strict -mode), including enclosing the -field names and operators in quotes. For example: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-d test \-c records \-q \(aq{ "a": { "$gte": 3 }, "date": { "$lt": { "$date": "2016\-01\-01T00:00:00.000Z" } } }\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-queryFile <path> -New in version 3.2. - -.sp -Specifies the path to a file containing a JSON document as a query -filter that limits the documents included in the output of -\fI\%mongodump\fP\&. \fI\%\-\-queryFile\fP enables you to create query filters that -are too large to fit in your terminal\(aqs buffer. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-readPreference <string|document> -\fIDefault\fP: \fBprimary\fP -.sp -Specifies the read preference for -\fBmongodump\fP\&. The \fI\%\-\-readPreference\fP option can take: -.INDENT 7.0 -.IP \(bu 2 -A string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference secondary -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -A quote\-enclosed document to specify the mode, the optional -read preference tag sets, and the -optional maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ], maxStalenessSeconds: 120}\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the maxStalenessSeconds, the value must be greater than or equal to 90. -.sp -New in version 4.2. - -.UNINDENT -.sp -\fBmongodump\fP defaults to \fBprimary\fP -read preference\&. -.sp -Starting in version 4.2, if the read -preference is also included in the \fI\%\-\-uri connection string\fP, the command\-line \fI\%\-\-readPreference\fP overrides the read preference -specified in the URI string. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Using a read preference other than -\fBprimary\fP with a connection to a \fBmongos\fP may produce -inconsistencies, duplicates, or result in missed documents. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-forceTableScan -By default, \fBmongodump\fP uses the \fB_id\fP index when scanning -collections with that index is available (e.g. -3.4\-reference\-views do not have any indexes). Specify \fI\%\-\-forceTableScan\fP -to direct \fBmongodump\fP to scan collection data without the use of the -\fB_id\fP index. -.sp -\fI\%\-\-forceTableScan\fP does not ensure a point\-in\-time snapshot. Use -\fI\%\-\-oplog\fP to create a point\-in\-time snapshot. -.sp -You cannot use \fI\%\-\-forceTableScan\fP with the \fI\%\-\-query\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gzip -New in version 3.2. - -.sp -Compresses the output. If \fI\%mongodump\fP outputs to the dump -directory, the new feature compresses the individual files. The files -have the suffix \fB\&.gz\fP\&. -.sp -If \fI\%mongodump\fP outputs to an archive file or the standard -out stream, the new feature compresses the archive file or the data -output to the stream. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-out <path>, \-o <path> -Specifies the directory where \fI\%mongodump\fP will write -BSON files for the dumped databases. By default, -\fI\%mongodump\fP saves output files in a directory named -\fBdump\fP in the current working directory. -.sp -To send the database dump to standard output, specify "\fB\-\fP" instead of -a path. Write to standard output if you want process the output before -saving it, such as to use \fBgzip\fP to compress the dump. When writing -standard output, \fI\%mongodump\fP does not write the metadata that -writes in a \fB<dbname>.metadata.json\fP file when writing to files -directly. -.sp -You cannot use the \fB\-\-archive\fP option with the -\fI\%\-\-out\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-archive <file or null> -New in version 3.2. - -.sp -Writes the output to a single archive file or to the standard output -(\fBstdout\fP). -.sp -To output the dump to an archive file, run \fI\%mongodump\fP with the new -\fB\-\-archive\fP option and the archive filename. -.sp -To output the dump to the standard output stream in order to pipe to -another process, run \fI\%mongodump\fP with the \fBarchive\fP option -but \fIomit\fP the filename. -.sp -You cannot use the \fB\-\-archive\fP option with the -\fI\%\-\-out\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-oplog -Creates a file named \fBoplog.bson\fP as part of the -\fI\%mongodump\fP output. The \fBoplog.bson\fP file, located in -the top level of the output directory, contains oplog entries that -occur during the \fI\%mongodump\fP operation. This file provides -an effective point\-in\-time snapshot of the state of a -\fBmongod\fP instance. To restore to a specific point\-in\-time -backup, use the output created with this option in conjunction with -\fBmongorestore \-\-oplogReplay\fP\&. -.sp -Without \fI\%\-\-oplog\fP, if there are write operations during the dump -operation, the dump will not reflect a single moment in time. Changes -made to the database during the update process can affect the output of -the backup. -.sp -\fI\%\-\-oplog\fP has no effect when running \fI\%mongodump\fP -against a \fBmongos\fP instance to dump the entire contents of a -sharded cluster. However, you can use \fI\%\-\-oplog\fP to dump -individual shards. -.sp -\fI\%\-\-oplog\fP only works against nodes that maintain an -oplog\&. This includes all members of a replica set. -.sp -\fI\%\-\-oplog\fP does not dump the oplog collection. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -To use \fI\%mongodump\fP with \fI\%\-\-oplog\fP, you must create a full dump of -a replica set member. \fI\%mongodump\fP with \fI\%\-\-oplog\fP fails -if you use any of the following options to limit the data to be dumped: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-collection\fP -.UNINDENT -.UNINDENT -.UNINDENT -.sp -\fBSEE ALSO:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBmongorestore \-\-oplogReplay\fP -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-dumpDbUsersAndRoles -Includes user and role definitions in the database\(aqs dump directory -when performing \fI\%mongodump\fP on a specific database. This -option applies only when you specify a database in the -\fI\%\-\-db\fP option. MongoDB always includes user and role -definitions when \fI\%mongodump\fP applies to an entire instance -and not just a specific database. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-excludeCollection string -New in version 3.0. - -.sp -Excludes the specified collection from the \fBmongodump\fP output. -To exclude multiple collections, specify the \fI\%\-\-excludeCollection\fP multiple times. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-excludeCollectionsWithPrefix string -New in version 3.0. - -.sp -Excludes all collections with a specified prefix from the \fBmongodump\fP -outputs. To specify multiple prefixes, specify the \fI\%\-\-excludeCollectionsWithPrefix\fP multiple -times. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-numParallelCollections int, \-j int -\fIDefault\fP: 4 -.sp -Number of collections \fBmongodump\fP should export -in parallel. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-viewsAsCollections -New in version 3.4. - -.sp -When specified, \fBmongodump\fP exports read\-only views as collections. For each view, \fBmongodump\fP will -produce a BSON file containing the documents in the view. If you -\fBmongorestore\fP the produced BSON file, the view will be -restored as a collection\&. -.sp -If you do \fInot\fP include \fI\%\-\-viewsAsCollections\fP, -\fBmongodump\fP captures each view\(aqs metadata. If you include a -view\(aqs metadata file in a \fBmongorestore\fP operation, the view -is recreated. -.UNINDENT -.SH EXAMPLES -.SS \fBmongodump\fP a Collection -.sp -The following operation creates a dump file that contains only the -collection named \fBcollection\fP in the database named \fBtest\fP\&. In -this case the database is running on the local interface on port -\fB27017\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-db test \-\-collection collection -.ft P -.fi -.UNINDENT -.UNINDENT -.SS \fBmongodump\fP a Database Excluding Specified Collections -.sp -The following operation dumps all collections in the \fBtest\fP database -except for \fBusers\fP and \fBsalaries\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-db test \-\-excludeCollection=users \-\-excludeCollection=salaries -.ft P -.fi -.UNINDENT -.UNINDENT -.SS \fBmongodump\fP with Access Control -.sp -In the next example, \fI\%mongodump\fP creates a database dump -located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database -running on port \fB37017\fP on the host \fBmongodb1.example.net\fP and -authenticating using the username \fBuser\fP and the password -\fBpass\fP, as follows: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password "pass" \-\-out /opt/backup/mongodump\-2011\-10\-24 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Output to an Archive File -.sp -New in version 3.2. - -.sp -To output the dump to an archive file, run \fI\%mongodump\fP with the -\fB\-\-archive\fP option and the archive filename. For example, the following -operation creates a file \fBtest.20150715.archive\fP that contains the dump -of the \fBtest\fP database. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-archive=test.20150715.archive \-\-db test -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Output an Archive to Standard Output -.sp -New in version 3.2. - -.sp -To output the archive to the standard output stream in order to pipe to -another process, run \fI\%mongodump\fP with the \fBarchive\fP -option but \fIomit\fP the filename: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-archive \-\-db test \-\-port 27017 | mongorestore \-\-archive \-\-port 27018 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fBNOTE:\fP -.INDENT 0.0 -.INDENT 3.5 -You cannot use the \fB\-\-archive\fP option with the -\fI\%\-\-out\fP option. -.UNINDENT -.UNINDENT -.SS Compress the Output -.sp -To compress the files in the output dump directory, run -\fI\%mongodump\fP with the new \fB\-\-gzip\fP option. For example, -the following operation outputs compressed files into the default -\fBdump\fP directory. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-gzip \-\-db test -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To compress the archive file output by \fI\%mongodump\fP, use the -\fB\-\-gzip\fP option in conjunction with the \fI\%\-\-archive\fP -option, specifying the name of the compressed file. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-archive=test.20150715.gz \-\-gzip \-\-db test -.ft P -.fi -.UNINDENT -.UNINDENT -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongoexport.1 b/debian/mongoexport.1 deleted file mode 100644 index 94ed4651bc8..00000000000 --- a/debian/mongoexport.1 +++ /dev/null @@ -1,1546 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOEXPORT" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongoexport \- MongoDB Export Utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Syntax\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongoexport\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -\fI\%mongoexport\fP is a command\-line tool that produces a JSON -or CSV export of data stored in a MongoDB instance. -.sp -Run \fI\%mongoexport\fP from the system command line, not the \fBmongo\fP shell. -.sp -\fBSEE ALSO:\fP -.INDENT 0.0 -.INDENT 3.5 -\fBmongoimport\fP which provides the corresponding "import" -capability. -.UNINDENT -.UNINDENT -.SH SYNTAX -.sp -\fI\%mongoexport\fP must be run directly from the system command line. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-collection <coll> [options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You must specify the \fI\%collection\fP to -export. If you do not specify an \fI\%output file\fP, \fI\%mongoexport\fP writes to the standard output (e.g. -stdout). -.SS Connect to a MongoDB Instance -.sp -To connect to a local MongoDB instance running on port 27017, you do -not have to specify the host or port. -.sp -For example, to export the specified \fI\%collection\fP to the specified \fI\%output file\fP from a local MongoDB instance running on port 27017: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-collection events \-\-db reporting \-\-out events.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To specify a host and/or port of the MongoDB instance, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-uri connection string\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongodb0.example.com:27017/reporting" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If using the \fI\%\-\-uri connection string\fP, -specify the database as part of the string. You cannot use the -command\-line option \fI\%\-\-db\fP in conjunction -with the \fI\%\-\-uri connection string\fP\&. -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-host\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "mongodb0.example.com:27017" \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Specify the hostname and port in the \fI\%\-\-host\fP and \fI\%\-\-port\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "mongodb0.example.com" \-\-port 27017 \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.SS Connect to a Replica Set -.sp -To connect to a replica set to export its data, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the replica set name and members in the \fI\%\-\-uri connection string\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If using the \fI\%\-\-uri connection string\fP, -specify the database as part of the string. You cannot use the -command\-line option \fI\%\-\-db\fP in conjunction -with the \fI\%\-\-uri connection string\fP\&. -.IP \(bu 2 -Specify the replica set name and members in the \fI\%\-\-host\fP: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -By default, \fI\%mongoexport\fP reads from the primary of the -replica set. To override the default, you can specify the read -preference: -.INDENT 0.0 -.IP \(bu 2 -You can specify the read preference in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the read preference tags, include the -\fBreadPreferenceTags\fP option: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If using the \fI\%\-\-uri connection string\fP, -specify the database as part of the string. You cannot use the -command\-line option \fI\%\-\-db\fP in conjunction -with the \fI\%\-\-uri connection string\fP\&. -.IP \(bu 2 -You can specify the read preference in using the -\fI\%\-\-readPreference\fP command\-line -option. The command\-line option takes a string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" \-\-readPreference secondary \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Or, the command\-line option can takes a quote\-enclosed document -\fB\(aq{ mode: <mode>, tagSets: [ <tag1>, ... ], maxStalenessSeconds:<num>}\(aq\fP -to specify the mode, the optional read preference tag -sets, and the optional -maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" \-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ]}\(aq \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.SS Connect to a Sharded Cluster -.sp -To connect to a sharded cluster to export its data, you can either: -.INDENT 0.0 -.IP \(bu 2 -Specify the hostname of the \fBmongos\fP instance in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongos0.example.com:27017/reporting" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If using the \fI\%\-\-uri connection string\fP, -specify the database as part of the string. You cannot use the -command\-line option \fI\%\-\-db\fP in conjunction -with the \fI\%\-\-uri connection string\fP\&. -.IP \(bu 2 -Specify the hostname and port of the \fBmongos\fP instance in the \fI\%\-\-host\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "mongos0.example.com:27017" \-\-collection events \-\-db reporting \-\-out events.json[additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -By default, \fI\%mongoexport\fP reads from the primary of the -shard replica set. To override the default, you can specify the read -preference: -.INDENT 0.0 -.IP \(bu 2 -You can specify the read preference in the -\fI\%\-\-uri connection string\fP -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongos0.example.com:27017/reporting?readPreference=secondary" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the read preference tags, include the -\fBreadPreferenceTags\fP option: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri "mongodb://mongos0.example.com:27017/reporting?readPreference=secondary&readPreferenceTags=region:east" \-\-collection events \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If using the \fI\%\-\-uri connection string\fP, -specify the database as part of the string. You cannot use the -command\-line option \fI\%\-\-db\fP in conjunction -with the \fI\%\-\-uri connection string\fP\&. -.IP \(bu 2 -You can specify the read preference in using the -\fI\%\-\-readPreference\fP command\-line -option. The command\-line option takes a string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "mongos0.example.com:27017" \-\-readPreference secondary \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Or, the command\-line option can takes a quote\-enclosed document -\fB\(aq{ mode: <mode>, tagSets: [ <tag1>, ... ], maxStalenessSeconds:<num>}\(aq\fP -to specify the mode, the optional read preference tag -sets, and the optional -maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host "mongos0.example.com:27017" \-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ]}\(aq \-\-collection events \-\-db reporting \-\-out events.json [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.sp -For more information on the options available, see \fI\%Options\fP\&. -.sp -\fBSEE ALSO:\fP -.INDENT 0.0 -.INDENT 3.5 -\fI\%Examples\fP -.UNINDENT -.UNINDENT -.SH REQUIRED ACCESS -.sp -\fI\%mongoexport\fP requires read access on the target database. -.sp -Ensure that the connecting user possesses, at a minimum, the \fBread\fP -role on the target database. -.sp -When connecting to a \fBmongod\fP or \fBmongos\fP that enforces -/core/authentication, ensure you use the required security -parameters based on the configured -authentication mechanism\&. -.SH BEHAVIOR -.SS Type Fidelity -.sp -\fBWARNING:\fP -.INDENT 0.0 -.INDENT 3.5 -Avoid using \fBmongoimport\fP and \fI\%mongoexport\fP for -full instance production backups. They do not reliably preserve all rich -BSON data types, because JSON can only represent a subset -of the types supported by BSON. Use \fBmongodump\fP -and \fBmongorestore\fP as described in /core/backups for this -kind of functionality. -.UNINDENT -.UNINDENT -.sp -Starting in version 4.2, \fI\%mongoexport\fP: -.INDENT 0.0 -.IP \(bu 2 -Outputs data in Extended JSON v2.0 (Relaxed mode) by default. -.IP \(bu 2 -Outputs Extended JSON v2.0 (Canonical mode) if used with -\fI\%\-\-jsonFormat\fP\&. -.UNINDENT -.sp -Earlier versions used Extended JSON v1.0 (Canonical mode)\&. -.sp -For example, the following insert operation in the \fBmongo\fP -shell uses the various shell helpers for the -BSON types Date and 64\-bit integer: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -use test -db.traffic.insert( { _id: 1, volume: NumberLong(\(aq2980000\(aq), date: new Date() } ) -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The argument to 64\-bit integer must be quoted to avoid potential -loss of accuracy. -.sp -Use \fI\%mongoexport\fP to export the data: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db test \-\-collection traffic \-\-out traffic.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -In version 4.2+, the exported data is in Extended JSON v2.0 -(Relaxed mode)\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{"_id":1.0,"volume":2980000,"date":{"$date":"2019\-08\-05T16:18:29.559Z"}} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To output in Extended JSON v2.0 (Canonical -mode), include the -\fI\%\-\-jsonFormat=canonical\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db test \-\-collection traffic \-\-jsonFormat=canonical \-\-out traffic.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The exported data is in Extended JSON v2.0 (Canonical -mode): -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{"_id":{"$numberDouble":"1.0"},"volume":{"$numberLong":"2980000"},"date":{"$date":{"$numberLong":"1565363188675"}}} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -In version 4.0 and earlier, the exported data is in Extended JSON v1.0 (Strict mode) -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{"_id":1.0,"volume":{"$numberLong":"2980000"},"date":{"$date":"2019\-08\-05T16:18:29.559Z"}} -.ft P -.fi -.UNINDENT -.UNINDENT -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongoexport\&. mongoexport -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SS Read Preference -.sp -By default, \fI\%mongoexport\fP uses read preference -\fBprimary\fP\&. To override the default, you can specify the -read preference in the -\fI\%\-\-readPreference\fP command line -option or in the \fI\%\-\-uri connection string\fP\&. -.sp -Starting in version 4.2, if you specify read preference in the URI -string and the \fI\%\-\-readPreference\fP, the \fI\%\-\-readPreference\fP value overrides the read preference specified in the -URI string. -.sp -In earlier versions, the two options are incompatible. -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%mongoexport\fP removed the \fB\-\-dbpath\fP as well as related -\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. To use -\fI\%mongoexport\fP, you must run \fI\%mongoexport\fP against a running -\fBmongod\fP or \fBmongos\fP instance as appropriate. - -.sp -Changed in version 3.0.0: \fI\%mongoexport\fP removed the \fB\-\-csv\fP option. Use the -\fI\%\-\-type=csv\fP option to specify CSV format -for the output. - -.INDENT 0.0 -.TP -.B mongoexport -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongoexport\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongoexport\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongoexport\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongoexport\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, specify the -\fBreplSetName\fP and a seed list of set members, as in -the following: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <replSetName>/<hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When specifying the replica set list format, \fBmongoexport\fP always connects to -the primary\&. -.sp -You can also connect to any single member of the replica set by specifying -the host and port of only that member: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongoexport\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongoexport\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongoexport\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongoexport\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongoexport\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongoexport\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.sp -If you do not specify an authentication database, \fBmongoexport\fP -assumes that the database specified to export holds the user\(aqs credentials. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongoexport\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-db <database>, \-d <database> -Specifies the name of the database on which to run the \fBmongoexport\fP\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-db\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collection <collection>, \-c <collection> -Specifies the collection to export. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-fields <field1[,field2]>, \-f <field1[,field2]> -Specifies a field or fields to \fIinclude\fP in the export. Use a comma -separated list of fields to specify multiple fields. -.sp -If any of your field names include white space, use -quotation marks to enclose the field list. For example, if you wished -to export two fields, \fBphone\fP and \fBuser number\fP, you would -specify \fB\-\-fields "phone,user number"\fP\&. -.sp -For \fI\%csv\fP output formats, -\fI\%mongoexport\fP includes only the specified field(s), and the -specified field(s) can be a field within a sub\-document. -.sp -For JSON output formats, \fI\%mongoexport\fP includes -only the specified field(s) \fBand\fP the \fB_id\fP field, and if the -specified field(s) is a field within a sub\-document, the -\fI\%mongoexport\fP includes the sub\-document with all -its fields, not just the specified field within the document. -.sp -See: \fI\%Export Data in CSV Format using \-\-fields option\fP for sample usage. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-fieldFile <filename> -An alternative to \fI\%\-\-fields\fP\&. The -\fI\%\-\-fieldFile\fP option allows you to -specify in a file the field or fields to \fIinclude\fP in the export and is -\fBonly valid\fP with the \fI\%\-\-type\fP option -with value \fBcsv\fP\&. The -file must have only one field per line, and the line(s) must end with -the LF character (\fB0x0A\fP). -.sp -\fI\%mongoexport\fP includes only the specified field(s). The -specified field(s) can be a field within a sub\-document. -.sp -See \fI\%Use a File to Specify the Fields to Export in CSV Format\fP for sample usage. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-query <JSON>, \-q <JSON> -Provides a query as a JSON document (enclosed in quotes) to -return matching documents in the export. -.sp -You must enclose the query document in single quotes (\fB\(aq{ ... }\(aq\fP) to ensure that it does -not interact with your shell environment. -.sp -Starting in MongoDB 4.2, the query \fBmust\fP be in -Extended JSON v2 format (either relaxed or canonical/strict -mode), including enclosing the -field names and operators in quotes: -.sp -For example, given a collection named \fBrecords\fP in the database -\fBtest\fP with the following documents: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ "_id" : ObjectId("51f0188846a64a1ed98fde7c"), "a" : 1, "date" : ISODate("1960\-05\-01T00:00:00Z") } -{ "_id" : ObjectId("520e61b0c6646578e3661b59"), "a" : 1, "b" : 2, "date" : ISODate("1970\-05\-01T00:00:00Z") } -{ "_id" : ObjectId("520e642bb7fa4ea22d6b1871"), "a" : 2, "b" : 3, "c" : 5, "date" : ISODate("2010\-05\-01T00:00:00Z") } -{ "_id" : ObjectId("520e6431b7fa4ea22d6b1872"), "a" : 3, "b" : 3, "c" : 6, "date" : ISODate("2015\-05\-02T00:00:00Z") } -{ "_id" : ObjectId("520e6445b7fa4ea22d6b1873"), "a" : 5, "b" : 6, "c" : 8, "date" : ISODate("2018\-03\-01T00:00:00Z") } -{ "_id" : ObjectId("5cd0de910dbce4346295ae28"), "a" : 15, "b" : 5, "date" : ISODate("2015\-03\-01T00:00:00Z") } -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The following \fI\%mongoexport\fP uses the \fI\%\-q\fP option -to export only the documents with the field \fBa\fP greater than or -equal to (\fB$gte\fP) to \fB3\fP and the field \fBdate\fP less than -\fBISODate("2016\-01\-01T00:00:00Z")\fP (using the extended JSON v2 -format (relaxed mode) for dates { "$date": -"YYYY\-MM\-DDTHH:mm:ss.mmm<offset>"}): -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-d test \-c records \-q \(aq{ "a": { "$gte": 3 }, "date": { "$lt": { "$date": "2016\-01\-01T00:00:00.000Z" } } }\(aq \-\-out exportdir/myRecords.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The resulting file contains the following documents: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -{"_id":{"$oid":"520e6431b7fa4ea22d6b1872"},"a":3.0,"b":3.0,"c":6.0,"date":{"$date":"2015\-05\-02T00:00:00Z"}} -{"_id":{"$oid":"5cd0de910dbce4346295ae28"},"a":15.0,"b":5.0,"date":{"$date":"2015\-03\-01T00:00:00Z"}} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You can sort the results with the \fI\%\-\-sort\fP option to -\fI\%mongoexport\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-type <string> -\fIDefault\fP: json -.sp -New in version 3.0. - -.sp -Specifies the file type to export. Specify \fBcsv\fP for CSV -format or \fBjson\fP for JSON format. -.sp -If you specify \fBcsv\fP, then you must also use either -the \fI\%\-\-fields\fP or the \fI\%\-\-fieldFile\fP option to -declare the fields to export from the collection. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-out <file>, \-o <file> -Specifies a file to write the export to. If you do not specify a file -name, the \fI\%mongoexport\fP writes data to standard output -(e.g. \fBstdout\fP). -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-jsonFormat <canonical|relaxed> -\fIDefault\fP: relaxed -.sp -Modifies the output to use either canonical or relaxed mode of the -/reference/mongodb\-extended\-json format. -.sp -For differences between canonical and relaxed modes, see -/reference/mongodb\-extended\-json\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-jsonArray -Modifies the output of \fI\%mongoexport\fP to write the -entire contents of the export as a single JSON array. By -default \fI\%mongoexport\fP writes data using one JSON document -for every MongoDB document. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-pretty -New in version 3.0.0. - -.sp -Outputs documents in a pretty\-printed format JSON. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-noHeaderLine -New in version 3.4. - -.sp -By default, \fBmongoexport\fP includes the exported field names as the first -line in a CSV output. \fI\%\-\-noHeaderLine\fP directs \fBmongoexport\fP to export the -data without the list of field names. -\fI\%\-\-noHeaderLine\fP is \fBonly valid\fP with the -\fI\%\-\-type\fP option with value \fBcsv\fP\&. -.sp -See \fI\%Exclude Field Names from CSV Output\fP for sample usage. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-slaveOk, \-k -Deprecated since version 3.2. - -.sp -Sets the replica\-set\-read\-preference to \fBnearest\fP, -allowing \fI\%mongoexport\fP to read data from secondary -replica set members. -.sp -\fI\%\-\-readPreference\fP replaces \fB\-\-slaveOk\fP in MongoDB 3.2. You cannot -specify \fB\-\-slaveOk\fP when \fI\%\-\-readPreference\fP is specified. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Using a read preference other than -\fBprimary\fP with a connection to a \fBmongos\fP may produce -inconsistencies, duplicates, or result in missed documents. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-readPreference <string|document> -\fIDefault\fP: \fBprimary\fP -.sp -Specifies the read preference for -\fBmongoexport\fP\&. The \fI\%\-\-readPreference\fP option can take: -.INDENT 7.0 -.IP \(bu 2 -A string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference secondary -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -A quote\-enclosed document to specify the mode, the optional -read preference tag sets, and the -optional maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ], maxStalenessSeconds: 120}\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the maxStalenessSeconds, the value must be greater than or equal to 90. -.sp -New in version 4.2. - -.UNINDENT -.sp -\fBmongoexport\fP defaults to \fBprimary\fP -read preference\&. -.sp -Starting in version 4.2, if the read -preference is also included in the \fI\%\-\-uri connection string\fP, the command\-line \fI\%\-\-readPreference\fP overrides the read preference -specified in the URI string. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Using a read preference other than -\fBprimary\fP with a connection to a \fBmongos\fP may produce -inconsistencies, duplicates, or result in missed documents. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-forceTableScan -Forces \fI\%mongoexport\fP to scan the data store directly instead -of traversing the \fB_id\fP field index. Use \fI\%\-\-forceTableScan\fP to skip the -index. Typically there are two cases where this behavior is -preferable to the default: -.INDENT 7.0 -.IP 1. 3 -If you have key sizes over 800 bytes that would not be present -in the \fB_id\fP index. -.IP 2. 3 -Your database uses a custom \fB_id\fP field. -.UNINDENT -.sp -When you run with \fI\%\-\-forceTableScan\fP, \fI\%mongoexport\fP may return a -document more than once if a write operation interleaves with the -operation to cause the document to move. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Use \fI\%\-\-forceTableScan\fP with extreme caution -and consideration. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-skip <number> -Use \fI\%\-\-skip\fP to control where \fI\%mongoexport\fP begins -exporting documents. See \fBskip()\fP for information about -the underlying operation. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-limit <number> -Specifies a maximum number of documents to include in the -export. See \fBlimit()\fP for information about -the underlying operation. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sort <JSON> -Specifies an ordering for exported results. If an index does -\fBnot\fP exist that can support the sort operation, the results must -be \fIless than\fP 32 megabytes. -.sp -Use \fI\%\-\-sort\fP conjunction with \fI\%\-\-skip\fP and -\fI\%\-\-limit\fP to limit number of exported documents. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-out export.0.json -mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-skip 100 \-\-out export.1.json -mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-skip 200 \-\-out export.2.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -See \fBsort()\fP for information about the underlying -operation. -.UNINDENT -.SH EXAMPLES -.SS Export in CSV Format -.sp -Changed in version 3.0.0: \fI\%mongoexport\fP removed the \fB\-\-csv\fP option. Use the -\fI\%\-\-type=csv\fP option to specify CSV format -for the output. - -.SS Export Data in CSV Format using \fB\-\-fields\fP option -.sp -In the following example, \fI\%mongoexport\fP exports data from the -collection \fBcontacts\fP collection in the \fBusers\fP database in CSV -format to the file \fB/opt/backups/contacts.csv\fP\&. -.sp -The \fBmongod\fP instance that \fI\%mongoexport\fP connects to is -running on the localhost port number \fB27017\fP\&. -.sp -When you export in CSV format, you must specify the fields in the documents -to export. The operation specifies the \fBname\fP and \fBaddress\fP fields -to export. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db users \-\-collection contacts \-\-type=csv \-\-fields name,address \-\-out /opt/backups/contacts.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -name, address -Sophie Monroe, 123 Example Road -Charles Yu, 345 Sample Street -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Use a File to Specify the Fields to Export in CSV Format -.sp -For CSV exports only, you can also specify the fields in a file -containing the line\-separated list of fields to export. The file must -have only one field per line. -.sp -For example, you can specify the \fBname\fP and \fBaddress\fP fields in a -file \fBfields.txt\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -name -address -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Then, using the \fI\%\-\-fieldFile\fP option, specify the fields to export with -the file: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db users \-\-collection contacts \-\-type=csv \-\-fieldFile fields.txt \-\-out /opt/backups/contacts.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Exclude Field Names from CSV Output -.sp -New in version 3.4. - -.sp -MongoDB 3.4 added the \fI\%\-\-noHeaderLine\fP option for excluding the -field names in a CSV export. The following example exports the \fBname\fP -and \fBaddress\fP fields in the \fBcontacts\fP collection in the \fBusers\fP -database and uses \fI\%\-\-noHeaderLine\fP to suppress the output -of the field names as the first line: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db users \-\-collection contacts \-\-type csv \-\-fields name,address \-\-noHeaderLine \-\-out /opt/backups/contacts.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The CSV output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -Sophie Monroe, 123 Example Road -Charles Yu, 345 Sample Street -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Export in JSON Format -.sp -This example creates an export of the \fBcontacts\fP collection from the -MongoDB instance running on the localhost port number \fB27017\fP\&. This -writes the export to the \fBcontacts.json\fP file in JSON format. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db sales \-\-collection contacts \-\-out contacts.json -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Export from Remote Host Running with Authentication -.sp -The following example exports the \fBcontacts\fP collection in the -\fBmarketing\fP database from a remote MongoDB instance that requires -authentication. -.sp -Specify the: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-collection\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-out\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.SS Tip -.sp -Omit the \fI\%\-\-password\fP option to -have \fBmongoexport\fP prompt for the password: -.UNINDENT -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-host mongodb1.example.net \-\-port 27017 \-\-username someUser \-\-authenticationDatabase admin \-\-collection contacts \-\-db marketing \-\-out mdb1\-examplenet.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Alternatively, you use the \fI\%\-\-uri\fP option to specify the host, port, username, authentication database, and db. -.INDENT 0.0 -.INDENT 3.5 -.SS Tip -.sp -Omit the password in the URI string to have \fBmongoexport\fP prompt -for the password: -.UNINDENT -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-uri \(aqmongodb://someUser@mongodb0.example.com:27017/marketing?authsource=admin\(aq \-\-collection contacts \-\-out mdb1\-examplenet.json -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Export Query Results -.sp -You can export only the results of a query by supplying a query filter with -the \fI\%\-\-query\fP option, and limit the results to a single -database using the "\fI\%\-\-db\fP" option. -.sp -For instance, this command returns all documents in the \fBsales\fP -database\(aqs \fBcontacts\fP collection that contain a field named \fBdept\fP -equal to \fB"ABC"\fP and the field \fBdate\fP greater than or equal to -ISODate("2018\-01\-01") (using the canonical format for dates -{ "$date": "YYYY\-MM\-DDTHH:mm:ss.mmm<offset>"} ) -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoexport \-\-db sales \-\-collection contacts \-\-query \(aq{"dept": "ABC", date: { $gte: { "$date": "2018\-01\-01T00:00:00.000Z" } }}\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You must enclose the query document in single quotes (\fB\(aq{ ... }\(aq\fP) to ensure that it does -not interact with your shell environment. -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongofiles.1 b/debian/mongofiles.1 deleted file mode 100644 index 49475149358..00000000000 --- a/debian/mongofiles.1 +++ /dev/null @@ -1,935 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOFILES" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongofiles \- MongoDB GridFS Utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Commands\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongofiles\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -The \fI\%mongofiles\fP utility makes it possible to manipulate files -stored in your MongoDB instance in GridFS objects from the -command line. It is particularly useful as it provides an interface -between objects stored in your file system and GridFS. -.sp -All \fI\%mongofiles\fP commands have the following form: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles <options> <commands> <filename> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The components of the \fI\%mongofiles\fP command are: -.INDENT 0.0 -.IP 1. 3 -\fI\%Options\fP\&. You may use one or more of -these options to control the behavior of \fI\%mongofiles\fP\&. -.IP 2. 3 -\fI\%Commands\fP\&. Use one of these commands to -determine the action of \fI\%mongofiles\fP\&. -.IP 3. 3 -A filename which is either: the name of a file on your local\(aqs file -system, or a GridFS object. -.UNINDENT -.sp -Run \fI\%mongofiles\fP from the system command line, not the \fBmongo\fP shell. -.sp -\fBIMPORTANT:\fP -.INDENT 0.0 -.INDENT 3.5 -For replica sets, -\fI\%mongofiles\fP can only read from the set\(aqs -primary\&. -.UNINDENT -.UNINDENT -.SH REQUIRED ACCESS -.sp -In order to connect to a \fBmongod\fP that enforces authorization -with the \fB\-\-auth\fP option, you must use the -\fI\%\-\-username\fP and \fI\%\-\-password\fP options. The connecting user must possess, at a -minimum: -.INDENT 0.0 -.IP \(bu 2 -the \fBread\fP role for the accessed database when using the -\fBlist\fP, \fBsearch\fP or \fBget\fP commands, -.IP \(bu 2 -the \fBreadWrite\fP role for the accessed database when using -the \fBput\fP or \fBdelete\fP commands. -.UNINDENT -.SH BEHAVIOR -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongofiles\&. mongofiles -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SS Read Preference -.sp -By default, \fI\%mongofiles\fP uses read preference -\fBprimary\fP\&. To override the default, you can specify the -read preference in the -\fI\%\-\-readPreference\fP command line -option or in the \fI\%\-\-uri connection string\fP\&. -.sp -Starting in version 4.2, if you specify read preference in the URI -string and the \fI\%\-\-readPreference\fP, the \fI\%\-\-readPreference\fP value overrides the read preference specified in the -URI string. -.sp -In earlier versions, the two options are incompatible. -.SS Write Concern -.sp -Starting in version 4.2, you can specify both the -\fI\%\-\-writeConcern\fP and the -\fI\%\-\-uri connection string\fP option. If write -concern is specified using both options, the -\fI\%\-\-writeConcern\fP value overrides -the write concern specified in the URI string. -.sp -In earlier versions, the two options are incompatible. -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%mongofiles\fP removed the \fB\-\-dbpath\fP as well as related -\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. To use -\fI\%mongofiles\fP, you must run \fI\%mongofiles\fP against a running -\fBmongod\fP or \fBmongos\fP instance as appropriate. - -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongofiles\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongofiles\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongofiles\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port> -Specifies a resolvable hostname for the \fBmongod\fP that holds -your GridFS system. By default \fI\%mongofiles\fP attempts to connect -to a MongoDB process running on the localhost port number \fB27017\fP\&. -.sp -Optionally, specify a port number to connect a MongoDB instance running -on a port other than 27017. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongofiles\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongofiles\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongofiles\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongofiles\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongofiles\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongofiles\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongofiles\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-db <database>, \-d <database> -Specifies the name of the database on which to run the \fBmongofiles\fP\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-db\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-local <filename>, \-l <filename> -Specifies the local filesystem name of a file for get and put -operations. -.sp -In the \fBmongofiles put\fP and \fBmongofiles get\fP commands, -the required \fB<filename>\fP modifier refers to the name the object will -have in GridFS. \fI\%mongofiles\fP assumes that this reflects the -file\(aqs name on the local file system. This setting overrides this -default. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-type <MIME> -Provides the ability to specify a MIME type to describe the file -inserted into GridFS storage. \fI\%mongofiles\fP omits this option in -the default operation. -.sp -Use only with \fBmongofiles put\fP operations. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-replace, \-r -Alters the behavior of \fBmongofiles put\fP to replace existing -GridFS objects with the specified local file, rather than adding an -additional object with the same name. -.sp -In the default operation, files will not be overwritten by a -\fBmongofiles put\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-prefix string -\fIDefault\fP: fs -.sp -GridFS prefix to use. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-writeConcern <document> -\fIDefault\fP: majority -.sp -Specifies the write concern for each write operation that \fBmongofiles\fP -performs. -.sp -Specify the write concern as a document with w options: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-writeConcern "{w:\(aqmajority\(aq}" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the write concern is also included in the \fI\%\-\-uri -connection string\fP, the command\-line -\fI\%\-\-writeConcern\fP overrides the write concern specified in -the URI string. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-readPreference <string|document> -\fIDefault\fP: \fBprimary\fP -.sp -Specifies the read preference for -\fBmongofiles\fP\&. The \fI\%\-\-readPreference\fP option can take: -.INDENT 7.0 -.IP \(bu 2 -A string if specifying only the read preference mode: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference secondary -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -A quote\-enclosed document to specify the mode, the optional -read preference tag sets, and the -optional maxStalenessSeconds: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-readPreference \(aq{mode: "secondary", tagSets: [ { "region": "east" } ], maxStalenessSeconds: 120}\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If specifying the maxStalenessSeconds, the value must be greater than or equal to 90. -.sp -New in version 4.2. - -.UNINDENT -.sp -\fBmongofiles\fP defaults to \fBprimary\fP -read preference\&. -.sp -Starting in version 4.2, if the read -preference is also included in the \fI\%\-\-uri connection string\fP, the command\-line \fI\%\-\-readPreference\fP overrides the read preference -specified in the URI string. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Using a read preference other than -\fBprimary\fP with a connection to a \fBmongos\fP may produce -inconsistencies, duplicates, or result in missed documents. -.UNINDENT -.UNINDENT -.UNINDENT -.SH COMMANDS -.INDENT 0.0 -.TP -.B list <prefix> -Lists the files in the GridFS store. The characters specified after -\fBlist\fP (e.g. \fB<prefix>\fP) optionally limit the list of -returned items to files that begin with that string of characters. -.UNINDENT -.INDENT 0.0 -.TP -.B search <string> -Lists the files in the GridFS store with names that match any -portion of \fB<string>\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B put <filename> -Copy the specified file from the local file system into GridFS -storage. -.sp -Here, \fB<filename>\fP refers to the name the object will have in -GridFS, and \fI\%mongofiles\fP assumes that this reflects the name the -file has on the local file system. If the local filename is -different use the \fI\%mongofiles \-\-local\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B get <filename> -Copy the specified file from GridFS storage to the local file -system. -.sp -Here, \fB<filename>\fP refers to the name the object will have in -GridFS. \fI\%mongofiles\fP writes the file to the local -file system using the file\(aqs \fBfilename\fP in GridFS. To choose a -different location for the file on the local file system, use the -\fI\%\-\-local\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B get_id "<_id>" -New in version 3.2.0. - -.sp -Copy the file, specified by its \fB<_id>\fP, from GridFS storage to the -local file system. -.sp -Here \fB<_id>\fP refers to the extended JSON \fB_id\fP of the -object in GridFS: -.INDENT 7.0 -.IP \(bu 2 -Starting in MongoDB 4.2, \fBget_id\fP can accept either ObjectId -values or non\-ObjectId values for \fB<_id>\fP\&. -.IP \(bu 2 -In MongoDB 4.0 and earlier, \fBget_id\fP only -accepts \fB<ObjectId>\fP values. -.UNINDENT -.sp -\fI\%mongofiles\fP writes the file to the local -file system using the file\(aqs \fBfilename\fP in GridFS. To choose a -different location for the file on the local file system, use the -\fI\%\-\-local\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B delete <filename> -Delete the specified file from GridFS storage. -.UNINDENT -.INDENT 0.0 -.TP -.B delete_id "<_id>" -New in version 3.2.0. - -.sp -Delete the file, specified by its \fB<_id>\fP, from GridFS storage: -.INDENT 7.0 -.IP \(bu 2 -Starting in MongoDB 4.2, \fBdelete_id\fP can accept -either ObjectId values or non\-ObjectId values for \fB<_id>\fP\&. -.IP \(bu 2 -In MongoDB 4.0 and earlier, \fBdelete_id\fP only -accepts \fB<ObjectId>\fP values. -.UNINDENT -.UNINDENT -.SH EXAMPLES -.sp -To return a list of all files in a GridFS collection in the -\fBrecords\fP database, use the following invocation at the system shell: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records list -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -This \fI\%mongofiles\fP instance will connect to the -\fBmongod\fP instance running on the \fB27017\fP localhost -interface to specify the same operation on a different port or -hostname, and issue a command that resembles one of the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-\-port 37017 \-d records list -mongofiles \-\-host db1.example.net \-d records list -mongofiles \-\-host db1.example.net \-\-port 37017 \-d records list -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Modify any of the following commands as needed if you\(aqre connecting -the \fBmongod\fP instances on different ports or hosts. -.sp -To upload a file named \fB32\-corinth.lp\fP to the GridFS collection in -the \fBrecords\fP database, you can use the following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records put 32\-corinth.lp -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To delete the \fB32\-corinth.lp\fP file from this GridFS collection in -the \fBrecords\fP database, you can use the following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records delete 32\-corinth.lp -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To search for files in the GridFS collection in the \fBrecords\fP -database that have the string \fBcorinth\fP in their names, you can use -following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records search corinth -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To list all files in the GridFS collection in the \fBrecords\fP database -that begin with the string \fB32\fP, you can use the following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records list 32 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To fetch the file from the GridFS collection in the \fBrecords\fP -database named \fB32\-corinth.lp\fP, you can use the following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records get 32\-corinth.lp -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To fetch the file from the GridFS collection in the \fBrecords\fP database -with \fB_id: ObjectId("56feac751f417d0357e7140f")\fP, you can use -the following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongofiles \-d records get_id \(aqObjectId("56feac751f417d0357e7140f")\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You must include quotation marks around the \fB_id\fP\&. -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongoimport.1 b/debian/mongoimport.1 deleted file mode 100644 index f72ce2ce4df..00000000000 --- a/debian/mongoimport.1 +++ /dev/null @@ -1,1413 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOIMPORT" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongoimport \- MongoDB Import Utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongoimport\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -The \fI\%mongoimport\fP tool imports content from an -Extended JSON, CSV, or TSV export -created by \fBmongoexport\fP, or potentially, another third\-party export -tool. -.sp -See the mongoexport document for more information regarding -\fBmongoexport\fP, which provides the inverse "exporting" -capability. -.sp -Run \fI\%mongoimport\fP from the system command line, not the \fBmongo\fP shell. -.SH BEHAVIOR -.sp -\fBWARNING:\fP -.INDENT 0.0 -.INDENT 3.5 -Avoid using \fI\%mongoimport\fP and \fBmongoexport\fP for -full instance production backups. They do not reliably preserve all rich -BSON data types, because JSON can only represent a subset -of the types supported by BSON. Use \fBmongodump\fP -and \fBmongorestore\fP as described in /core/backups for this -kind of functionality. -.UNINDENT -.UNINDENT -.SS JSON Format -.sp -Starting in MongoDB 4.2, \fI\%mongoimport\fP expects import data -to be in Extended JSON v2.0 (either Relaxed or Canonical mode) -by default. To recognize data that is in Extended JSON v1.0 format, see -\fI\%\-\-legacy\fP\&. -.sp -In earlier versions, \fI\%mongoimport\fP expects data in -/reference/mongodb\-extended\-json\-v1 format. -.INDENT 0.0 -.INDENT 3.5 -.SS Tip -.sp -In general, the versions of \fBmongoexport\fP and -\fI\%mongoimport\fP should match. That is, to import data -created from \fBmongoexport\fP, you should use the -corresponding version of \fI\%mongoimport\fP\&. -.UNINDENT -.UNINDENT -.SS Encoding -.sp -\fI\%mongoimport\fP only supports data files that are UTF\-8 encoded. -Using other encodings will produce errors. -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongoimport\&. mongoimport -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SS Write Concern -.sp -Starting in version 4.2, if you specify write concern in both the -\fI\%\-\-writeConcern\fP option and the -\fI\%\-\-uri connection string\fP option, the -\fI\%\-\-writeConcern\fP value overrides -the write concern specified in the URI string. -.sp -In earlier versions, the two options are incompatible. -.SH REQUIRED ACCESS -.sp -In order to connect to a \fBmongod\fP that enforces authorization -with the \fB\-\-auth\fP option, you must use the -\fB\-\-username\fP and \fB\-\-password\fP options. The connecting user must -possess, at a minimum, the \fBreadWrite\fP role on the database -into which they are importing data. -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%mongoimport\fP removed the \fB\-\-dbpath\fP as well as related -\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. To use -\fI\%mongoimport\fP, you must run \fI\%mongoimport\fP against a running -\fBmongod\fP or \fBmongos\fP instance as appropriate. - -.INDENT 0.0 -.TP -.B mongoimport -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongoimport\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongoimport\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongoimport\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongoimport\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, specify the -\fBreplSetName\fP and a seed list of set members, as in -the following: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <replSetName>/<hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When specifying the replica set list format, \fBmongoimport\fP always connects to -the primary\&. -.sp -You can also connect to any single member of the replica set by specifying -the host and port of only that member: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongoimport\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongoimport\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongoimport\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongoimport\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongoimport\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongoimport\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongoimport\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-db <database>, \-d <database> -Specifies the name of the database on which to run the \fBmongoimport\fP\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-db\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collection <collection>, \-c <collection> -Specifies the collection to import. -.sp -New in version 2.6: If you do not specify \fI\%\-\-collection\fP, -\fI\%mongoimport\fP takes the collection name from the input -filename. MongoDB omits the extension of the file from the -collection name, if the input file has an extension. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-fields <field1[,field2]>, \-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. -.sp -If you attempt to include \fI\%\-\-fields\fP when importing JSON data, -\fBmongoimport\fP will return an error. \fI\%\-\-fields\fP is only for csv -or tsv imports. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-fieldFile <filename> -As an alternative to \fI\%\-\-fields\fP, the \fI\%\-\-fieldFile\fP -option allows you to specify a file that holds a list of field names if -your csv or tsv file does not include field names in the -first line of the file (i.e. header). Place one field per line. -.sp -If you attempt to include \fI\%\-\-fieldFile\fP when importing JSON data, -\fBmongoimport\fP will return an error. \fI\%\-\-fieldFile\fP is only for csv -or tsv imports. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ignoreBlanks -Ignores empty fields in csv and tsv exports. If not -specified, \fI\%mongoimport\fP creates fields without values in -imported documents. -.sp -If you attempt to include \fI\%\-\-ignoreBlanks\fP when importing JSON data, -\fBmongoimport\fP will return an error. \fI\%\-\-ignoreBlanks\fP is only for csv -or tsv imports. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-type <json|csv|tsv> -Specifies the file type to import. The default format is JSON, -but it\(aqs possible to import csv and tsv files. -.sp -The \fBcsv\fP parser accepts that data that complies with RFC -\fI\%RFC 4180\fP\&. As a result, backslashes are \fInot\fP a valid escape -character. If you use double\-quotes to enclose fields in the CSV -data, you must escape internal double\-quote marks by prepending -another double\-quote. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-file <filename> -Specifies the location and name of a file containing the data to import. -If you do not specify a file, \fI\%mongoimport\fP reads data from -standard input (e.g. "stdin"). -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-drop -Modifies the import process so that the target instance drops -the collection before importing the data from the input. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-headerline -If using \fI\%\-\-type csv\fP or \fI\%\-\-type -tsv\fP, uses the first line as field names. -Otherwise, \fI\%mongoimport\fP will import the first line as a -distinct document. -.sp -If you attempt to include \fI\%\-\-headerline\fP when importing JSON data, -\fBmongoimport\fP will return an error. \fI\%\-\-headerline\fP is only for csv -or tsv imports. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-mode insert|upsert|merge -\fIDefault\fP: insert -.sp -New in version 3.4. - -.sp -Specifies how the import process should handle existing documents -in the database that match documents in the import file. -.sp -By default, \fBmongoimport\fP uses the \fB_id\fP field to match documents in -the collection with documents in the import file. -To specify the fields against which to match existing -documents for the \fBupsert\fP and \fBmerge\fP modes, -use \fI\%\-\-upsertFields\fP\&. -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -\fBinsert\fP -T} T{ -Insert the documents in the import file. \fBmongoimport\fP will log -an error if you attempt to import a document that contains a -duplicate value for a field with a unique index, such as \fB_id\fP\&. -T} -_ -T{ -\fBupsert\fP -T} T{ -Replace existing documents in the database with matching -documents from the -import file. \fBmongoimport\fP will insert all other -documents. \fI\%Replace Matching Documents during Import\fP describes how to -use \fI\%\-\-mode\fP \fBupsert\fP\&. -T} -_ -T{ -\fBmerge\fP -T} T{ -Merge existing documents that match a document in the import file with -the new document. \fBmongoimport\fP will insert all other documents. -\fI\%Merge Matching Documents during Import\fP describes how to use \fI\%\-\-mode\fP -\fBmerge\fP\&. -T} -_ -.TE -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-upsertFields <field1[,field2]> -Specifies a list of fields for the query portion of the -upsert\&. -Use this option if the \fB_id\fP fields in the -existing documents don\(aqt match the field in the document, but -another field or field combination can uniquely identify -documents as a basis for performing upsert operations. -.sp -Changed in version 3.4: Modifies the import process to update existing objects in the -database if they match based on the specified fields, while -inserting all other objects. You do not need to use \fI\%\-\-mode -upsert\fP with \fI\%\-\-upsertFields\fP\&. -.sp -If you do not specify a field, \fI\%\-\-upsertFields\fP will upsert on the basis of -the \fB_id\fP field. - -.sp -To ensure adequate performance, indexes should exist for this -field or fields. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-stopOnError -Forces \fBmongoimport\fP to halt the insert operation at the -first error rather than continuing the operation despite errors. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-jsonArray -Accepts the import of data expressed with multiple MongoDB documents -within a single JSON array. Limited to -imports of 16 MB or smaller. -.sp -Use \fI\%\-\-jsonArray\fP in conjunction with \fBmongoexport \-\-jsonArray\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-legacy -Indicates that the import data is in Extended JSON v1 format instead of the default -Extended JSON v2 format\&. -.INDENT 7.0 -.INDENT 3.5 -.SH TIP -.sp -In general, the versions of \fBmongoexport\fP and -\fI\%mongoimport\fP should match. That is, to import -data created from \fBmongoexport\fP, you should use -the corresponding version of \fI\%mongoimport\fP\&. -.UNINDENT -.UNINDENT -.sp -For example, if the import data is in v1 format: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -{"_id":1.0,"myregfield":{"$regex":"foo","$options":"i"}} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Import without the \fI\%\-\-legacy\fP option results in -the following document in the collection: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ "_id" : 1, "myregfield" : { "$regex" : "foo", "$options" : "i" } } -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Import with the \fI\%\-\-legacy\fP results in -the following document in the collection: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ "_id" : 1, "myregfield" : { "$regularExpression" : { "pattern" : "foo", "options" : "i" } } } -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -New in version 4.2. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-maintainInsertionOrder -\fIDefault\fP: False -.sp -If specified, \fBmongoimport\fP inserts the documents in the order of -their appearance in the input source, otherwise \fBmongoimport\fP may -perform the insertions in an arbitrary order. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-numInsertionWorkers int -\fIDefault\fP: 1 -.sp -New in version 3.0.0. - -.sp -Specifies the number of insertion workers to run concurrently. -.sp -For large imports, increasing the number of insertion workers -may increase the speed of the import. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-writeConcern <document> -\fIDefault\fP: majority -.sp -Specifies the write concern for each write operation that \fBmongoimport\fP -performs. -.sp -Specify the write concern as a document with w options: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-writeConcern "{w:\(aqmajority\(aq}" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the write concern is also included in the \fI\%\-\-uri -connection string\fP, the command\-line -\fI\%\-\-writeConcern\fP overrides the write concern specified in -the URI string. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-bypassDocumentValidation -Enables \fBmongoimport\fP to bypass document validation -during the operation. This lets you insert documents that do not -meet the validation requirements. -.sp -New in version 3.2.1. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-columnsHaveTypes -New in version 3.4. - -.sp -Instructs \fBmongoimport\fP that the -field list specified in \fI\%\-\-fields\fP, \fI\%\-\-fieldFile\fP, -or \fI\%\-\-headerline\fP specifies the types of each field. -.sp -Field names must be in the form of \fB<colName>.<type>(<arg>)\fP\&. You -must backslash\-escape the following characters if you wish to include -them in an argument: \fB(\fP, \fB)\fP, and \fB\e\fP\&. -.TS -center; -|l|l|l|. -_ -T{ -\fBtype\fP -T} T{ -Supported Arguments -T} T{ -Example Header Field -T} -_ -T{ -\fBauto()\fP -T} T{ -None. -T} T{ -\fBmisc.auto()\fP -T} -_ -T{ -\fBbinary(<arg>)\fP -T} T{ -.INDENT 7.0 -.IP \(bu 2 -\fBbase32\fP (\fI\%RFC4648\fP encoding schema) -.IP \(bu 2 -\fBbase64\fP (\fI\%RFC4648\fP encoding schema) -.IP \(bu 2 -\fBhex\fP -.UNINDENT -T} T{ -\fBuser thumbnail.binary(base64)\fP -T} -_ -T{ -\fBboolean()\fP -T} T{ -None. -T} T{ -\fBverified.boolean()\fP -T} -_ -T{ -\fBdate(<arg>)\fP -T} T{ -Alias for \fBdate_go(<arg>)\fP\&. \fI\%Go Language time.Parse format\fP\&. -T} T{ -\fBcreated.date(2006\-01\-02 15:04:05)\fP -T} -_ -T{ -\fBdate_go(<arg>)\fP -T} T{ -\fI\%Go Language time.Parse format\fP -T} T{ -\fBcreated.date_go(2006\-01\-02 15:04:05)\fP -T} -_ -T{ -\fBdate_ms(<arg>)\fP -T} T{ -\fI\%Microsoft SQL Server FORMAT format\fP -T} T{ -\fBcreated.date_ms(yyyy\-MM\-dd H:mm:ss)\fP -T} -_ -T{ -\fBdate_oracle(<arg>)\fP -T} T{ -\fI\%Oracle Database TO_DATE format\fP\&. -T} T{ -\fBcreated.date_oracle(YYYY\-MM\-DD HH24:MI:SS)\fP -T} -_ -T{ -\fBdecimal()\fP -T} T{ -None -T} T{ -\fBprice.decimal()\fP -T} -_ -T{ -\fBdouble()\fP -T} T{ -None. -T} T{ -\fBrevenue.double()\fP -T} -_ -T{ -\fBint32()\fP -T} T{ -None. -T} T{ -\fBfollowerCount.int32()\fP -T} -_ -T{ -\fBint64()\fP -T} T{ -None. -T} T{ -\fBbigNumber.int64()\fP -T} -_ -T{ -\fBstring()\fP -T} T{ -None. -T} T{ -\fBzipcode.string()\fP -T} -_ -.TE -.sp -See \fI\%Import CSV with Specified Field Types\fP for sample usage. -.sp -If you attempt to include \fI\%\-\-columnsHaveTypes\fP when importing JSON data, -\fBmongoimport\fP will return an error. \fI\%\-\-columnsHaveTypes\fP is only for csv -or tsv imports. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-parseGrace <grace> -\fIDefault\fP: stop -.sp -New in version 3.4. - -.sp -Specifies how \fBmongoimport\fP handles type coercion failures when importing -CSV or TSV files with \fI\%\-\-columnsHaveTypes\fP\&. -.sp -\fI\%\-\-parseGrace\fP has no effect when importing JSON documents. -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -\fBautoCast\fP -T} T{ -Assigns a type based on the value of the field. -For example, if a field is defined as a \fBdouble\fP and the -value for that field was \fB"foo"\fP, \fBmongoimport\fP would make -that field value a string type. -T} -_ -T{ -\fBskipField\fP -T} T{ -For the row being imported, \fBmongoimport\fP does not include the -field whose type does not match the expected type. -T} -_ -T{ -\fBskipRow\fP -T} T{ -\fBmongoimport\fP does not import rows containing a value whose -type does not match the expected type. -T} -_ -T{ -\fBstop\fP -T} T{ -\fBmongoimport\fP returns an error that ends the import. -T} -_ -.TE -.UNINDENT -.SH EXAMPLES -.SS Simple Import -.sp -\fI\%mongoimport\fP restores a database from a backup taken with -\fBmongoexport\fP\&. Most of the arguments to \fBmongoexport\fP also -exist for \fI\%mongoimport\fP\&. -.sp -In the following example, \fI\%mongoimport\fP imports -the JSON data from the \fBcontacts.json\fP file into the collection -\fBcontacts\fP in the \fBusers\fP database. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-db users \-\-collection contacts \-\-file contacts.json -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Replace Matching Documents during Import -.sp -Changed in version 3.4: In MongoDB 3.4, \fI\%\-\-mode upsert\fP replaces the -deprecated \fB\-\-upsert\fP option. - -.sp -With \fI\%\-\-mode\fP \fBupsert\fP, \fI\%mongoimport\fP replaces -existing documents in the database that match a document in the -import file with the document from the import file. -Documents that do not match an existing document in the database are -inserted as usual. By default \fI\%mongoimport\fP matches documents -based on the \fB_id\fP field. Use \fI\%\-\-upsertFields\fP to specify -the fields to match against. -.sp -Consider the following document in the \fBpeople\fP collection in the -\fBexample\fP database: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "name" : "Crystal Duncan", - "region" : "United States", - "email" : "crystal@example.com" -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The following document exists in a \fBpeople\-20160927.json\fP JSON file. -The \fB_id\fP field of the JSON object matches the \fB_id\fP field of the -document in the \fBpeople\fP collection. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "username" : "crystal", - "likes" : [ "running", "pandas", "software development" ] -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To import the \fBpeople\-20160927.json\fP file and replace documents in -the database that match the documents in the import file, specify \fI\%\-\-mode\fP -\fBupsert\fP, as in the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-c people \-d example \-\-mode upsert \-\-file people\-20160927.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The document in the \fBpeople\fP collection would then contain only -the fields from the imported document, as in the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "username" : "crystal", - "likes" : [ "running", "pandas", "software development" ] -} -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Merge Matching Documents during Import -.sp -New in version 3.4. - -.sp -With \fI\%\-\-mode\fP \fBmerge\fP, \fI\%mongoimport\fP enables you to -merge fields from a new record with an existing document in the -database. Documents that do not match an existing document in the -database are inserted as usual. By default \fI\%mongoimport\fP -matches documents based on the \fB_id\fP field. Use -\fI\%\-\-upsertFields\fP to specify the fields to match against. -.sp -The \fBpeople\fP collection in the \fBexample\fP database contains the -following document: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "name" : "Crystal Duncan", - "region" : "United States", - "email" : "crystal@example.com" -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The following document exists in a \fBpeople\-20160927.json\fP JSON file. -The \fB_id\fP field of the JSON object matches the \fB_id\fP field of the -document in the \fBpeople\fP collection. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "username" : "crystal", - "email": "crystal.duncan@example.com", - "likes" : [ "running", "pandas", "software development" ] -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To import the \fBpeople\-20160927.json\fP file and merge documents from -the import file with matching documents in the database, specify -\fI\%\-\-mode\fP \fBmerge\fP, as in the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-c people \-d example \-\-mode merge \-\-file people\-20160927.json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The import operation combines the fields from the JSON file with the -original document in the database, -matching the documents based on the \fB_id\fP field. -During the import process, \fI\%mongoimport\fP adds the new \fBusername\fP and -\fBlikes\fP fields to the document and updates the \fBemail\fP field with -the value from the imported document, as in the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "_id" : ObjectId("580100f4da893943d393e909"), - "name" : "Crystal Duncan", - "region" : "United States", - "email" : "crystal.duncan@example.com", - "username" : "crystal", - "likes" : [ - "running", - "pandas", - "software development" - ] -} -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Import \fBJSON\fP to Remote Host Running with Authentication -.sp -In the following example, \fI\%mongoimport\fP imports data from the -file \fB/opt/backups/mdb1\-examplenet.json\fP into the \fBcontacts\fP collection -within the database \fBmarketing\fP on a remote MongoDB -database with authentication enabled. -.sp -\fI\%mongoimport\fP connects to the \fBmongod\fP instance running on -the host \fBmongodb1.example.net\fP over port \fB37017\fP\&. It authenticates with the -username \fBuser\fP and the password \fBpass\fP\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password "pass" \-\-collection contacts \-\-db marketing \-\-file /opt/backups/mdb1\-examplenet.json -.ft P -.fi -.UNINDENT -.UNINDENT -.SS \fBCSV\fP Import -.SS General CSV Import -.sp -In the following example, \fI\%mongoimport\fP imports the csv -formatted data in the \fB/opt/backups/contacts.csv\fP file into the -collection \fBcontacts\fP in the \fBusers\fP database on the MongoDB -instance running on the localhost port numbered -\fB27017\fP\&. -.sp -Specifying \fI\%\-\-headerline\fP instructs -\fI\%mongoimport\fP to determine the name of the fields using the first -line in the CSV file. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-db users \-\-collection contacts \-\-type csv \-\-headerline \-\-file /opt/backups/contacts.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fI\%mongoimport\fP uses the input file name, without the -extension, as the collection name if \fB\-c\fP or \fB\-\-collection\fP is -unspecified. The following example is therefore equivalent: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-db users \-\-type csv \-\-headerline \-\-file /opt/backups/contacts.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Import CSV with Specified Field Types -.sp -New in version 3.4. - -.sp -MongoDB 3.4 added support for specifying field types. Specify field -names and types in the form \fB<colName>.<type>(<arg>)\fP using -\fI\%\-\-fields\fP, \fI\%\-\-fieldFile\fP, or \fI\%\-\-headerline\fP\&. -.sp -Consider the following CSV data: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -Katherine Gray, 1996\-02\-03, F, 1235, TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWduYSBhbGlxdWEuIFV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBxdWlzIG5vc3RydWQgZXhlcmNpdGF0aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuIER1aXMgYXV0ZSBpcnVyZSBkb2xvciBpbiByZXByZWhlbmRlcml0IGluIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlIGNpbGx1bSBkb2xvcmUgZXUgZnVnaWF0IG51bGxhIHBhcmlhdHVyLiBFeGNlcHRldXIgc2ludCBvY2NhZWNhdCBjdXBpZGF0YXQgbm9uIHByb2lkZW50LCBzdW50IGluIGN1bHBhIHF1aSBvZmZpY2lhIGRlc2VydW50IG1vbGxpdCBhbmltIGlkIGVzdCBsYWJvcnVtLg== -Albert Gilbert, 1992\-04\-24, T, 13, Q3VwY2FrZSBpcHN1bSBkb2xvciBzaXQgYW1ldCB0b290c2llIHJvbGwgYm9uYm9uIHRvZmZlZS4gQ2FuZHkgY2FuZXMgcGllIGNyb2lzc2FudCBjaG9jb2xhdGUgYmFyIGxvbGxpcG9wIGJlYXIgY2xhdyBtYWNhcm9vbi4gU3dlZXQgcm9sbCBjdXBjYWtlIGNoZWVzZWNha2Ugc291ZmZsw6kgYnJvd25pZSBpY2UgY3JlYW0uIEp1anViZXMgY2FrZSBjdXBjYWtlIG1hY2Fyb29uIGRhbmlzaCBqZWxseS1vIHNvdWZmbMOpLiBDYWtlIGFwcGxlIHBpZSBnaW5nZXJicmVhZCBjaG9jb2xhdGUgc3VnYXIgcGx1bS4gU3dlZXQgY2hvY29sYXRlIGNha2UgY2hvY29sYXRlIGNha2UganVqdWJlcyB0aXJhbWlzdSBvYXQgY2FrZS4gU3dlZXQgc291ZmZsw6kgY2hvY29sYXRlLiBMaXF1b3JpY2UgY290dG9uIGNhbmR5IGNob2NvbGF0ZSBtYXJzaG1hbGxvdy4gSmVsbHkgY29va2llIGNha2UgamVsbHkgYm -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fI\%\-\-fields\fP option specifies which -field type \fI\%mongoimport\fP will use when importing the data -into MongoDB. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-db users \-\-collection contacts \-\-type csv \-\-columnsHaveTypes \-\-fields "name.string(),birthdate.date(2006\-01\-02),contacted.boolean(),followerCount.int32(),user thumbnail.binary(base64)" \-\-file /example/file.csv -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Ignore Blank Fields -.sp -Use the \fI\%\-\-ignoreBlanks\fP option -to ignore blank fields. For CSV and TSV imports, this -option provides the desired functionality in most cases because it avoids -inserting fields with null values into your collection. -.sp -The following example imports the data from \fBdata.csv\fP, skipping -any blank fields: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoimport \-\-db users \-\-collection contacts \-\-type csv \-\-file /example/data.csv \-\-ignoreBlanks -.ft P -.fi -.UNINDENT -.UNINDENT -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongoreplay.1 b/debian/mongoreplay.1 deleted file mode 100644 index 00f4cc388e8..00000000000 --- a/debian/mongoreplay.1 +++ /dev/null @@ -1,1298 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOREPLAY" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongoreplay \- MongoDB Traffic Capture and Replay Tool -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Commands\fP -.IP \(bu 2 -\fI\%mongoreplay Report Format\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.SH SYNOPSIS -.sp -New in version 3.4. - -.INDENT 0.0 -.INDENT 3.5 -.IP "Availability" -.sp -Available for Linux and macOS. -.UNINDENT -.UNINDENT -.sp -\fI\%mongoreplay\fP is a traffic capture and replay tool for MongoDB -that you can use to inspect and record commands sent to a MongoDB -instance, and then replay those commands back onto another host at a -later time. -.sp -\fI\%mongoreplay\fP can help you preview how your MongoDB deployment -will perform a production workload under a different environment, -such as with a different storage engine, on different hardware, or -with a different operating system configuration. -\fI\%mongoreplay\fP can also help reproduce and investigate an issue by -recording and replaying the operations that trigger the issue. -Finally, \fI\%mongoreplay\fP serves as a more flexible version of -the legacy \fBmongosniff\fP tool to help you investigate database activity. -.sp -Run \fI\%mongoreplay\fP from the system command line, not the \fBmongo\fP shell. -.SH REQUIRED ACCESS -.sp -\fI\%mongoreplay\fP requires access to the network interface that -the \fI\%record\fP or \fI\%monitor\fP commands will -listen on. You may need to run \fI\%mongoreplay\fP with root privileges -to access the network device. -.sp -\fI\%mongoreplay\fP will not work with MongoDB instances using an SSL connection. -.sp -\fBWARNING:\fP -.INDENT 0.0 -.INDENT 3.5 -Only use root privileges when connecting to trusted sources. -.UNINDENT -.UNINDENT -.sp -If you are using \fI\%play\fP to connect to a MongoDB deployment -that enforces access control, you must -connect as a user with the required privileges to execute the -recorded operations. Include the user\(aqs credentials in the -\fI\%\-\-host\fP MongoDB connection string. -.SH OPTIONS -.INDENT 0.0 -.TP -.B mongoreplay -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbosity, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-debug, \-d -Increases the amount of detail about \fBmongoreplay\fP operations -and errors recorded -in log files. Increase the debugging detail with the \fB\-d\fP form by -including the option multiple times, (e.g. \fB\-ddd\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-silent, \-s -When set, \fBmongoreplay\fP does not produce any log output. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongoreplay\fP\&. -.UNINDENT -.SH COMMANDS -.sp -\fI\%mongoreplay\fP includes the following \fIcommands\fP to record, -play back, and monitor MongoDB network traffic. -.SS \fBmongoreplay record\fP -.sp -\fI\%record\fP produces a playback file based on -network traffic. \fI\%record\fP supports collecting network -traffic directly or can -accept a \fI\%pcap file\fP -to produce the playback file. -The playback file contains a list of all requests sent to the -\fBmongod\fP instance during the recording as well as all -responses transmitted to the client during the recording. The playback -file also records metadata for each request, such as the connection -identifier and timestamp. -.sp -The following prototype uses \fI\%mongoreplay\fP to record data -on the loopback network interface and creates a playback file -located at \fB~/recordings/playback\fP\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay record \-i eth0 \-e "port 27017" \-p ~/recordings/playback -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Similarly, the following prototype uses \fI\%mongoreplay\fP -to produce a playback file from an existing pcap file: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay record \-f traffic.pcap \-p ~/recordings/playback -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fBrecord\fP supports the following options: -.INDENT 0.0 -.TP -.B mongoreplay record -.UNINDENT -.INDENT 0.0 -.TP -.B record -.UNINDENT -.INDENT 0.0 -.TP -.B \-f <path> -Specifies the path to a pcap file that \fI\%record\fP should read to -produce a playback file. -.sp -Use \fB\-f\fP as an alternative to capturing network traffic using -\fB\-i\fP\&. You must specify \fIeither\fP \fB\-f\fP or \fB\-i\fP\&. If you include -both options, \fBmongoreplay record\fP produces an error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-b <number> -Size of heap used to merge separate streams together. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-expr <filter expression>, \-e <filter expression> -An expression in \fI\%Berkeley Packet Filter (BPF) syntax\fP to apply to incoming traffic to -record. Required if you are capturing traffic from a network interface using -\fI\%\-i\fP\&. -.sp -For example, to capture traffic from a MongoDB instance running on -port 27017, you would specify \fB\-e \(aqport 27017\(aq\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-i <interface> -Specifies the network interface that \fI\%record\fP should listen on to -capture network traffic. -.sp -Use with \fI\%\-e\fP\&. -.sp -Use \fB\-i\fP as an alternative to reading an existing pcap file with -\fB\-i\fP\&. You must specify \fIeither\fP \fB\-f\fP or \fB\-i\fP\&. If you include -both options, \fBmongoreplay record\fP produces an error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gzip <boolean> -If specified, \fI\%record\fP compresses the playback file with gzip. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-playback\-file <path>, \-p <path> -Specifies the path to which to write the playback file. -.sp -The produced playback file is a BSON file. -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.SS See -.sp -\fI\%Use record\fP for examples of using -\fI\%mongoreplay\fP with the \fBrecord\fP command. -.UNINDENT -.UNINDENT -.SS \fBmongoreplay play\fP -.sp -\fBNOTE:\fP -.INDENT 0.0 -.INDENT 3.5 -Starting in MongoDB 4.0, \fI\%mongoreplay play\fP supports a new -\fBMONGOREPLAY_HOST\fP environment variable that specifies the -MongoDB connection string. The new environment -vairable can be used instead of the command\-line \fI\%\-\-host\fP option. -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B play -\fI\%play\fP replays a playback file created with -\fI\%record\fP against a \fBmongod\fP instance. -.UNINDENT -.sp -For example, the following uses \fI\%mongoreplay play\fP to replay the -\fB~/recordings/playback\fP playback file to the \fBmongod\fP instance running on -\fB192.168.0.4:27018\fP: -.INDENT 0.0 -.IP \(bu 2 -Using the \fI\%\-\-host\fP option: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay play \-p ~/recordings/playback \-\-report ~/reports/replay_stats.json \-\-host mongodb://192.168.0.4:27018 -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Using the \fBMONGOREPLAY_HOST\fP environment variable (Available starting in MongoDB 4.0): -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -export MONGOREPLAY_HOST="mongodb://192.168.0.4:27018" -mongoreplay play \-p ~/recordings/playback \-\-report ~/reports/replay_stats.json -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.SS \fBplay\fP Options -.sp -\fBplay\fP supports the following options: -.INDENT 0.0 -.TP -.B mongoreplay play -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collect <json|format|none> -\fIDefault\fP: format -.sp -Specifies the output format for the collected statistics. -.INDENT 7.0 -.IP \(bu 2 -\fBjson\fP: outputs stat information as json -.IP \(bu 2 -\fBformat\fP: uses the formatting specified in the \fB\-\-format\fP option -to produce the output file. -.IP \(bu 2 -\fBnone\fP: does not provide any output -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-report <path> -Specifies the path to which to write an execution report. -Use \fI\%\-\-collect\fP to specify the output format for the report. -.sp -If you do not specify \fB\-\-report\fP, \fI\%play\fP writes to STDOUT. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-no\-truncate -If specified, disables truncation of large reply payload data in the -\fI\%play\fP log output. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-format -\fIDefault\fP: \fB%F{blue}%t%f %F{cyan}(Connection: %o:%i)%f %F{yellow}%l%f -%F{red}%T %c%f %F{white}%n%f -%F{green}%Q{Request:}%f%q%F{green}%R{Response:}%f%r)\fP -.sp -Specifies the format for terminal output. -You can specify arguments immediately after the format \(aqverbs\(aq by wrapping -them in curly braces, as in \fB%Q{<arg>}\fP\&. -.sp -If you specify \fI\%\-\-format\fP, also specify \fBformat\fP as the value for the -\fI\%\-\-collect\fP option. -.sp -\fI\%\-\-format\fP supports the following verbs: -.INDENT 7.0 -.IP \(bu 2 -\fB%n\fP: namespace -.IP \(bu 2 -\fB%l\fP: latency -.IP \(bu 2 -\fB%t\fP: time. You may optionally specify the date layout using the -Go Programming Language\(aqs \fI\%time formatting\fP\&. Go -uses \fBMon Jan 2 15:04:05 MST 2006\fP as its reference time. You -must specify the time format using the reference time. Thus, if you -wanted to print the date in format \fByyyy\-mm\-dd hh:mm\fP, you would -specify \fB%t{2006\-01\-02 15:04}\fP\&. Refer to the Go \fI\%time formatting\fP -documentation for more information. -.IP \(bu 2 -\fB%T\fP: op time -.IP \(bu 2 -\fB%c\fP: command -.IP \(bu 2 -\fB%o\fP: number of connections -.IP \(bu 2 -\fB%i\fP: request ID -.IP \(bu 2 -\fB%q\fP: request. You may optinally specified a dot\-delimited field -within the JSON structure, as in, \fB%q{command_args.documents}\fP\&. -.IP \(bu 2 -\fB%r\fP: response. You may optinally specified a dot\-delimited field -within the JSON structure, as in, \fB%q{command_args.documents}\fP\&. -.IP \(bu 2 -\fB%Q{<arg>}\fP: display \fB<arg>\fP on presence of request data -.IP \(bu 2 -\fB%R{<arg>}\fP: display \fB<arg>\fP on presence of response data -.UNINDENT -.sp -In addition, \fI\%\-\-format\fP supports the following start/end ANSI escape sequences: -.INDENT 7.0 -.IP \(bu 2 -\fB%B\fP/\fB%b\fP: bold -.IP \(bu 2 -\fB%U\fP/\fB%u\fP: underline -.IP \(bu 2 -\fB%S\fP/\fB%s\fP: standout -.IP \(bu 2 -\fB%F\fP/\fB%f\fP: text color (required arg \-\- word or number, 8\-color) -.IP \(bu 2 -\fB%K\fP/\fB%k\fP: background color (required arg \-\- same as %F/%f) -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-no\-colors -When set, removes colors from the \fI\%default format\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-playback\-file <path>, \-p <path> -Specifies the path from which to read the playback file. -.sp -If the playback file was created using the \fI\%\-\-gzip\fP option, you must also specify \fB\-\-gzip\fP -when running \fI\%play\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-speed number -\fIDefault\fP: 1.0 -.sp -Specifies a multiplier to adjust playback speed. \fB\-\-speed 1.0\fP -processes the playback file in real time; \fB\-\-speed 0.5\fP at half -speed; \fB\-\-speed 3.0\fP at triple speed. -.sp -The specified speed is a \fItarget\fP speed. If \fBmongoreplay play\fP encounters -a bottleneck, playback may be slower than the specified multiplier. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <uri connection string> -\fIDefault\fP: mongodb://localhost:27017 -.sp -Specifies a MongoDB connection string -for the MongoDB deployment to which to -play back the captured network traffic. -.sp -By default, \fI\%play\fP -attempts to connect to a \fBmongod\fP instance running on the localhost on -port number \fB27017\fP\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -Starting in MongoDB 4.0, \fI\%mongoreplay play\fP supports a new -\fBMONGOREPLAY_HOST\fP environment variable that specifies the -connection string for the MongoDB deployment. The new environment -vairable can be used instead of the command\-line \fI\%\-\-host\fP option. -.sp -If \fI\%\-\-host\fP command\-line option is -specified, the \fI\%\-\-host\fP value overrides -the environment variable. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-repeat number -\fIDefault\fP: 1 -.sp -Specifies the number of times to play the playback file. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-queueTime number -\fIDefault\fP: 15 -.sp -Specifies the maximum time, in seconds, to queue operations in advance -of transmitting them. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-no\-preprocess -When set, \fI\%play\fP does not preprocess the input file to pre\-map -data such as MongoDB cursor IDs. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gzip <boolean> -If specified, \fI\%play\fP decompresses the playback file with gzip. -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.SS See -.sp -\fI\%Use play\fP for examples of using -\fI\%mongoreplay\fP with the \fI\%play\fP command. -.UNINDENT -.UNINDENT -.SS \fBmongoreplay monitor\fP -.sp -\fI\%monitor\fP inspects live or pre\-recorded -MongoDB network traffic. -.sp -The following prototype uses \fI\%mongoreplay\fP to produce a -JSON report based on the \fBplayback.bson\fP playback file in the \fB~/recordings\fP directory: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay monitor \-\-collect json \-\-report ~/reports/monitor\-report.json \-p ~/recordings/playback.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fBmonitor\fP supports the following options: -.INDENT 0.0 -.TP -.B mongoreplay monitor -.UNINDENT -.INDENT 0.0 -.TP -.B monitor -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collect <json|format|none> -\fIDefault\fP: format -.sp -Specifies the output format for the collected statistics. -.INDENT 7.0 -.IP \(bu 2 -\fBjson\fP: outputs stat information as json -.IP \(bu 2 -\fBformat\fP: uses the formatting specified in the \fB\-\-format\fP option -to produce the output file. -.IP \(bu 2 -\fBnone\fP: does not provide any output -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-report <path> -Specifies the path to which to write an execution report. -Use \fI\%\-\-collect\fP to specify the output format for the report. -.sp -If you do not specify \fB\-\-report\fP, \fI\%monitor\fP writes to STDOUT. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-no\-truncate -If specified, disables truncation of large reply payload data in the -\fI\%monitor\fP log output. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-format -\fIDefault\fP: \fB%F{blue}%t%f %F{cyan}(Connection: %o:%i)%f %F{yellow}%l%f -%F{red}%T %c%f %F{white}%n%f -%F{green}%Q{Request:}%f%q%F{green}%R{Response:}%f%r)\fP -.sp -Specifies the format for terminal output. -You can specify arguments immediately after the format \(aqverbs\(aq by wrapping -them in curly braces, as in \fB%Q{<arg>}\fP\&. -.sp -If you specify \fI\%\-\-format\fP, also specify \fBformat\fP as the value for the -\fI\%\-\-collect\fP option. -.sp -\fI\%\-\-format\fP supports the following verbs: -.INDENT 7.0 -.IP \(bu 2 -\fB%n\fP: namespace -.IP \(bu 2 -\fB%l\fP: latency -.IP \(bu 2 -\fB%t\fP: time. You may optionally specify the date layout using the -Go Programming Language\(aqs \fI\%time formatting\fP\&. Go -uses \fBMon Jan 2 15:04:05 MST 2006\fP as its reference time. You -must specify the time format using the reference time. Thus, if you -wanted to print the date in format \fByyyy\-mm\-dd hh:mm\fP, you would -specify \fB%t{2006\-01\-02 15:04}\fP\&. Refer to the Go \fI\%time formatting\fP -documentation for more information. -.IP \(bu 2 -\fB%T\fP: op time -.IP \(bu 2 -\fB%c\fP: command -.IP \(bu 2 -\fB%o\fP: number of connections -.IP \(bu 2 -\fB%i\fP: request ID -.IP \(bu 2 -\fB%q\fP: request. You may optinally specified a dot\-delimited field -within the JSON structure, as in, \fB%q{command_args.documents}\fP\&. -.IP \(bu 2 -\fB%r\fP: response. You may optinally specified a dot\-delimited field -within the JSON structure, as in, \fB%q{command_args.documents}\fP\&. -.IP \(bu 2 -\fB%Q{<arg>}\fP: display \fB<arg>\fP on presence of request data -.IP \(bu 2 -\fB%R{<arg>}\fP: display \fB<arg>\fP on presence of response data -.UNINDENT -.sp -In addition, \fI\%\-\-format\fP supports the following start/end ANSI escape sequences: -.INDENT 7.0 -.IP \(bu 2 -\fB%B\fP/\fB%b\fP: bold -.IP \(bu 2 -\fB%U\fP/\fB%u\fP: underline -.IP \(bu 2 -\fB%S\fP/\fB%s\fP: standout -.IP \(bu 2 -\fB%F\fP/\fB%f\fP: text color (required arg \-\- word or number, 8\-color) -.IP \(bu 2 -\fB%K\fP/\fB%k\fP: background color (required arg \-\- same as %F/%f) -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-no\-colors -When set, removes colors from the \fI\%default format\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-f <path> -Specifies the path to a pcap file that \fI\%monitor\fP should read to -produce a playback file. -.sp -Use \fB\-f\fP as an alternative to capturing network traffic using -\fB\-i\fP\&. You must specify \fIeither\fP \fB\-f\fP or \fB\-i\fP\&. If you include -both options, \fBmongoreplay monitor\fP produces an error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-b <number> -Size of heap used to merge separate streams together. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-expr <filter expression>, \-e <filter expression> -An expression in \fI\%Berkeley Packet Filter (BPF) syntax\fP to apply to incoming traffic to -record. Required if you are capturing traffic from a network interface using -\fI\%\-i\fP\&. -.sp -For example, to capture traffic from a MongoDB instance running on -port 27017, you would specify \fB\-e \(aqport 27017\(aq\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-i <interface> -Specifies the network interface that \fI\%monitor\fP should listen on to -capture network traffic. -.sp -Use with \fI\%\-e\fP\&. -.sp -Use \fB\-i\fP as an alternative to reading an existing pcap file with -\fB\-i\fP\&. You must specify \fIeither\fP \fB\-f\fP or \fB\-i\fP\&. If you include -both options, \fBmongoreplay monitor\fP produces an error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-paired -When specified, \fI\%monitor\fP outputs one line for each request/reply pair record. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gzip <boolean> -If specified, \fI\%monitor\fP decompresses the playback file with gzip. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-playback\-file <path>, \-p <path> -Specifies the path from which to read the playback file. -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.SS See -.sp -\fI\%Use monitor\fP for examples of using -\fI\%mongoreplay\fP with the \fI\%monitor\fP command. -.UNINDENT -.UNINDENT -.SH MONGOREPLAY REPORT FORMAT -.sp -\fI\%monitor\fP and \fI\%play\fP can produce -reports based on a playback file when run with the \fB\-\-report\fP option. -.SS Sample Record -.sp -The following is an example record from a JSON\-formatted -\fI\%monitor\fP report: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "order" : 21, - "op" : "op_msg", - "command" : "aggregate", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "aggregate" : "foo", - "cursor" : {}, - "lsid" : { - "id" : { - "$binary" : "eBZNIaAbRTiAoWkaNZ0T8Q==", - "$type" : "04" - } - }, - "pipeline" : [ - { "$match" : { "borough" : "Queens" } }, - { "$group" : { "_id" : "$cuisine", "count" : { "$sum": 1 } } } - ] - }, - "payloadType" : 0 - } - ] - }, - "connection_num" : 0, - "seen" : "2018\-11\-15T14:07:07.136794\-05:00", - "request_id" : 25 -} -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Fields -.sp -\fI\%mongoreplay\fP reports can include the following fields: -.INDENT 0.0 -.TP -.B order -A monotonically increasing key indicating the order in which the -operations were recorded and played back. This can be used to -reconstruct the ordering of the series of operations executed on a -connection, since the order in which they appear in the report file -may not match the playback order. -.UNINDENT -.INDENT 0.0 -.TP -.B op -The type of operation represented by the request: i.e. "query", -"insert", "command", "getmore". -.UNINDENT -.INDENT 0.0 -.TP -.B command -The name of the database command performed, such as \fBisMaster\fP or -\fBgetLastError\fP\&. This field is left blank for operations that are not -commands, such as queries and inserts. -.UNINDENT -.INDENT 0.0 -.TP -.B ns -The namespace on which the request was executed. -.UNINDENT -.INDENT 0.0 -.TP -.B request_data -The payload of the operation. -.INDENT 7.0 -.IP \(bu 2 -Query operations: \fBrequest_data\fP contains the actual -query that was issued. -.IP \(bu 2 -Insert operations: \fBrequest_data\fP contains the documents -being inserted. -.IP \(bu 2 -Update operations: \fBrequest_data\fP contains the query -selector and the update modifier. -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B reply_data -The payload of the reply to the request. -.UNINDENT -.INDENT 0.0 -.TP -.B nreturned -The number of documents returned as a result of the operation. -.UNINDENT -.INDENT 0.0 -.TP -.B played_at -The time at which the \fI\%play\fP command executed -the operation. -.UNINDENT -.INDENT 0.0 -.TP -.B play_at -The time at which the operation was supposed to be executed by -the \fI\%play\fP command. -.UNINDENT -.INDENT 0.0 -.TP -.B playbacklag_us -The difference in microseconds in time between \fBplayed_at\fP -and \fBplay_at\fP\&. Higher values generally indicate that the -target server is not able to keep up with the rate at which requests -need to be executed according to the playback file. -.UNINDENT -.INDENT 0.0 -.TP -.B connection_num -A key that identifies the connection on which the request was -executed. All requests/replies that executed on the same connection -have the same value for \fBconnection_num\fP\&. -.sp -The \fBconnection_num\fP value -does \fInot\fP match the connection ID logged on the server side. -.UNINDENT -.INDENT 0.0 -.TP -.B latency_us -The time difference in microseconds between when the request was -sent by the client and when a response from the server was received. -.UNINDENT -.INDENT 0.0 -.TP -.B errors -Lists any errors returned from the server. -.UNINDENT -.INDENT 0.0 -.TP -.B msg -Lists the error message returned from the server. -.UNINDENT -.INDENT 0.0 -.TP -.B seen -The time at which the operation was originally captured. -.UNINDENT -.INDENT 0.0 -.TP -.B request_id -The ID of the MongoDB operation. The \fBrequest_id\fP for a request -operation is the same as the \fBresponse_id\fP for the corresponding -reply. -.UNINDENT -.SS Output Formatting with \fB\-\-format\fP -.sp -\fI\%monitor\fP and \fI\%play\fP output to either the -terminal or, when run with \fB\-\-report\fP (i.e. \fI\%monitor \-\-report\fP or \fI\%play \-\-report\fP), to a file. -.sp -Use the \fB\-\-collect\fP (\fI\%monitor \-\-collect\fP or \fI\%play \-\-collect\fP) -option to specify the format of the output: -.INDENT 0.0 -.IP \(bu 2 -\fB\-\-collect json\fP produces JSON output, -.IP \(bu 2 -\fB\-\-collect format\fP outputs the data based on the formatting -specified by the \fB\-\-format\fP option for \fI\%monitor\fP and \fI\%play\fP . -.UNINDENT -.SH EXAMPLES -.SS Use \fI\%record\fP -.SS Capture TCP data with \fBrecord\fP -.sp -To create a recording of traffic, use the \fI\%record\fP command. The -following operation records traffic through port \fB27017\fP on the -\fBeth0\fP network interface and writes the captured traffic to -\fB~/recordings/recording.bson\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay record \-i eth0 \-e "port 27017" \-p ~/recordings/recording.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The produced playback file contains everything needed to re\-execute -the workload on another system. -.SS Record a Playback File from Existing pcap Data -.sp -If you do not wish to use \fI\%mongoreplay\fP to capture traffic, you -can capture traffic using a utility such as \fBtcpdump\fP and then create a -\fI\%mongoreplay\fP recording from the static pcap file. -.sp -\fBWARNING:\fP -.INDENT 0.0 -.INDENT 3.5 -Only use root privileges when connecting to a trusted source. -.UNINDENT -.UNINDENT -.sp -The following operation uses \fBtcpdump\fP to capture traffic through -port \fB27017\fP on the \fBeth0\fP network interface and writes the captured -data to a pcap file called \fBtraffic.pcap\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -sudo tcpdump \-B $((100*1024)) \-i eth0 \-n "port 27017" \-w traffic.pcap -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To create the \fI\%mongoreplay\fP playback file, you can use -\fI\%record\fP with the \fI\%\-f\fP -option to specify the pcap file from which to create the playback file, -as in the following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay record \-f traffic.pcap \-p ~/recordings/playback.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The produced playback file contains everything needed to re\-execute -the workload on another system. -.SS Use \fI\%play\fP -.SS Execute a Playback File Against a Target Host -.sp -\fI\%play\fP takes a playback file and executes the -recorded operations against the \fBmongodb://example.com:27018\fP host. -Since the \fBmongod\fP enforces authentication, the -connection string specified to -\fI\%\-\-host\fP also includes the username, password, and authentication -database so that \fI\%mongoreplay\fP can write to the database. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay play \-p ~/recordings/recording.bson \-\-host mongodb://username:password@example.com:27018/admin -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -By default, \fB~bin.play\fP executes the playback -file at the rate of the recording. \fI\%\-\-speed\fP lets you modify -the playback speed. For example, the following operation executes -the operations in \fBrecording.bson\fP at twice the recording speed: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay play \-p ~/recordings/recording.bson \-\-speed=2.0 \-\-host mongodb://username:password@example.com:27018/admin -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Log Metrics About Execution Performance during Playback -.sp -\fI\%play\fP can produce a report with detailed metrics -about the performance of each operation executed during playback. -.sp -The following example executes playback against the -\fBmongodb://example.com:27017\fP host and produces a JSON report written to -\fB~/reports/playback\-report.json\fP -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay play \-p ~/recordings/recording.bson \-\-report ~/reports/playback\-report.json \-\-collect json \-\-host mongodb://example.com:27017 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fBplay\fP report contents would resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "order" : 0, - "op" : "op_msg", - "command" : "isMaster", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "forShell" : 1, - "isMaster" : 1 - }, - "payloadType" : 0 - } - ] - }, - "reply_data" : { - "sections" : [ - { - "payload" : { - "ismaster" : true, - "localTime" : { - "$date" : "2018\-11\-15T21:35:01.843Z" - }, - "logicalSessionTimeoutMinutes" : 30, - "maxBsonObjectSize" : 16777216, - "maxMessageSizeBytes" : 48000000, - "maxWireVersion" : 7, - "maxWriteBatchSize" : 100000, - "minWireVersion" : 0, - "ok" : 1, - "readOnly" : false - }, - "payloadType" : 0 - } - ] - }, - "played_at" : "2018\-11\-15T16:35:01.84304\-05:00", - "play_at" : "2018\-11\-15T16:35:01.842903\-05:00", - "playbacklag_us" : 137, - "connection_num" : 1, - "latency_us" : 151, - "seen" : "2018\-11\-15T21:30:33.379675Z", - "request_id" : 21 -} -{ - "order" : 2, - "op" : "op_msg", - "command" : "listCollections", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "authorizedCollections" : true, - "filter" : { - - }, - "listCollections" : 1, - "lsid" : { - "id" : { - "$binary" : "esmcqhiXSIWSpKGb4sOekw==", - "$type" : "04" - } - }, - "nameOnly" : true - }, - "payloadType" : 0 - } - ] - }, - "reply_data" : { - "sections" : [ - { - "payload" : { - "cursor" : { - "firstBatch" : [ ], - "id" : { - "$numberLong" : "0" - }, - "ns" : "test.$cmd.listCollections" - }, - "ok" : 1 - }, - "payloadType" : 0 - } - ] - }, - "played_at" : "2018\-11\-15T16:35:08.715002\-05:00", - "play_at" : "2018\-11\-15T16:35:08.713539\-05:00", - "playbacklag_us" : 1463, - "connection_num" : 1, - "latency_us" : 331, - "seen" : "2018\-11\-15T21:30:40.250311Z", - "request_id" : 22 -} -{ - "order" : 4, - "op" : "op_msg", - "command" : "isMaster", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "forShell" : 1, - "isMaster" : 1 - }, - "payloadType" : 0 - } - ] - }, - "reply_data" : { - "sections" : [ - { - "payload" : { - "ismaster" : true, - "localTime" : { - "$date" : "2018\-11\-15T21:35:08.715Z" - }, - "logicalSessionTimeoutMinutes" : 30, - "maxBsonObjectSize" : 16777216, - "maxMessageSizeBytes" : 48000000, - "maxWireVersion" : 7, - "maxWriteBatchSize" : 100000, - "minWireVersion" : 0, - "ok" : 1, - "readOnly" : false - }, - "payloadType" : 0 - } - ] - }, - "played_at" : "2018\-11\-15T16:35:08.715554\-05:00", - "play_at" : "2018\-11\-15T16:35:08.71471\-05:00", - "playbacklag_us" : 844, - "connection_num" : 1, - "latency_us" : 208, - "seen" : "2018\-11\-15T21:30:40.251482Z", - "request_id" : 23 -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Refer to \fI\%mongoreplay Report Format\fP for a description of each field. -.SS Use \fI\%monitor\fP -.SS Inspect Recorded Operations -.sp -\fI\%monitor\fP can create a report based on the -contents of a playback file. \fI\%monitor\fP\(aqs report includes -\fIall\fP operations and some metadata about each operation\(aqs execution. -.sp -The following operation uses \fI\%monitor\fP to create a JSON -report based on the contents of the \fBrecording.bson\fP playback file -located in the \fB~/recordings\fP directory and write the report to -\fB~/reports/monitoring\-report.json\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay monitor \-p ~/recordings/recording.bson \-\-report ~/reports/monitoring\-report.json \-\-collect json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The report contents would resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -{ - "order" : 0, - "op" : "op_msg", - "command" : "isMaster", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "forShell" : 1, - "isMaster" : 1 - }, - "payloadType" : 0 - } - ] - }, - "connection_num" : 0, - "seen" : "2018\-11\-15T21:30:33.379675Z", - "request_id" : 21 -} -{ - "order" : 1, - "op" : "op_msg", - "command" : "aggregate", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "aggregate" : "restaurants", - "cursor" : { - - }, - "lsid" : { - "id" : { - "$binary" : "esmcqhiXSIWSpKGb4sOekw==", - "$type" : "04" - } - }, - "pipeline" : [ - { - "$match" : { - "borough" : "Manhattan" - } - }, - { - "$group" : { - "_id" : "$cuisine" - } - } - ] - }, - "payloadType" : 0 - } - ] - }, - "connection_num" : 0, - "seen" : "2018\-11\-15T16:28:52.870007\-05:00", - "request_id" : 13 -} -{ - "order" : 1, - "op" : "op_msg", - "command" : "reply", - "reply_data" : { - "sections" : [ - { - "payload" : { - "ismaster" : true, - "localTime" : { - "$date" : "2018\-11\-15T21:30:33.379Z" - }, - "logicalSessionTimeoutMinutes" : 30, - "maxBsonObjectSize" : 16777216, - "maxMessageSizeBytes" : 48000000, - "maxWireVersion" : 7, - "maxWriteBatchSize" : 100000, - "minWireVersion" : 0, - "ok" : 1, - "readOnly" : false - }, - "payloadType" : 0 - } - ] - }, - "connection_num" : 0, - "latency_us" : 174, - "seen" : "2018\-11\-15T21:30:33.379849Z", - "request_id" : 21 -} -{ - "order" : 2, - "op" : "op_msg", - "command" : "listCollections", - "ns" : "test", - "request_data" : { - "sections" : [ - { - "payload" : { - "$db" : "test", - "authorizedCollections" : true, - "filter" : { - - }, - "listCollections" : 1, - "lsid" : { - "id" : { - "$binary" : "esmcqhiXSIWSpKGb4sOekw==", - "$type" : "04" - } - }, - "nameOnly" : true - }, - "payloadType" : 0 - } - ] - }, - "connection_num" : 0, - "seen" : "2018\-11\-15T21:30:40.250311Z", - "request_id" : 22 -} -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Refer to \fI\%mongoreplay Report Format\fP for a description of each field. -.SS Inspect Live MongoDB Traffic -.sp -\fI\%monitor\fP can also inspect live traffic and, optionally, -create a report based on the observed operations. -.sp -To monitor traffic in real time in your terminal, omit the -\fI\%\-\-report\fP option, as in the -following: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay monitor \-i eth0 \-e \(aqport 27017\(aq \-\-collect json -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Optionally, you can create a report based on the operations observed -using \fI\%monitor\fP\&. The following example creates a JSON -report written to \fB~/reports/monitor\-live.json\fP based on the traffic -through port \fB27017\fP on the \fBeth0\fP network interface: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongoreplay monitor \-i eth0 \-e \(aqport 27017\(aq \-\-report ~/reports/monitor\-live.json \-\-collect json -.ft P -.fi -.UNINDENT -.UNINDENT -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongorestore.1 b/debian/mongorestore.1 deleted file mode 100644 index d75f598b099..00000000000 --- a/debian/mongorestore.1 +++ /dev/null @@ -1,1502 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGORESTORE" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongorestore \- MongoDB Data Restoration Tool -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Usage in Backup Strategy\fP -.IP \(bu 2 -\fI\%Syntax\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Examples\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongorestore\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -The \fI\%mongorestore\fP program loads data from either a binary -database dump created by \fBmongodump\fP or the standard input -(starting in version 3.0.0) into a \fBmongod\fP or -\fBmongos\fP instance. -.SH USAGE IN BACKUP STRATEGY -.SS Standalones/Replica Sets -.sp -For an overview of \fI\%mongorestore\fP usage as part of a -backup and recovery strategy, see -/tutorial/backup\-and\-restore\-tools\&. -.SS Sharded Clusters -.sp -Starting in MongoDB 4.2, \fBmongodump\fP and -\fI\%mongorestore\fP \fBcannot\fP be part of a backup -strategy for sharded clusters. These manual tools do not maintain -the atomicity guarantees of transactions across shards. -.sp -To maintain the atomicity guarantees of transactions across shards, -use the coordinated backup and restore services provided by: -.INDENT 0.0 -.IP \(bu 2 -\fI\%MongoDB Atlas\fP, -.IP \(bu 2 -\fI\%MongoDB Cloud Manager\fP, or -.IP \(bu 2 -\fI\%MongoDB Ops Manager\fP\&. -.UNINDENT -.SH SYNTAX -.sp -Run \fI\%mongorestore\fP from the system command line, not the \fBmongo\fP shell. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore [options] [<directory>/<BSON file>] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For example, to restore from a \fBdump\fP directory to a local -\fBmongod\fP instance running on port \fB27017\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -As \fI\%mongorestore\fP restores from the \fBdump/\fP directory, -it creates the database and collections as needed and logs its progress: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-07\-08T14:37:38.942\-0400 preparing collections to restore from -2019\-07\-08T14:37:38.944\-0400 reading metadata for test.bakesales from dump/test/bakesales.metadata.json -2019\-07\-08T14:37:38.944\-0400 reading metadata for test.salaries from dump/test/salaries.metadata.json -2019\-07\-08T14:37:38.976\-0400 restoring test.salaries from dump/test/salaries.bson -2019\-07\-08T14:37:38.985\-0400 no indexes to restore -2019\-07\-08T14:37:38.985\-0400 finished restoring test.salaries (10 documents, 0 failures) -2019\-07\-08T14:37:39.009\-0400 restoring test.bakesales from dump/test/bakesales.bson -2019\-07\-08T14:37:39.011\-0400 restoring indexes for collection test.bakesales from metadata -2019\-07\-08T14:37:39.118\-0400 finished restoring test.bakesales (21 documents, 0 failures) -2019\-07\-08T14:37:39.118\-0400 restoring users from dump/admin/system.users.bson -2019\-07\-08T14:37:39.163\-0400 restoring roles from dump/admin/system.roles.bson -2019\-07\-08T14:37:39.249\-0400 31 document(s) restored successfully. 0 document(s) failed to restore. -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You can also restore a specific collection or collections from the -\fBdump/\fP directory. For example, the following operation restores a -single collection from corresponding data files in the \fBdump/\fP -directory: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-nsInclude test.purchaseorders dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the \fBdump/\fP directory does not contain the corresponding data file -for the specified namespace, no data will be restored. For example, the -following specifies a collection namespace that does not have a -corresponding data in the \fBdump/\fP directory: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-nsInclude foo.bar dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fI\%mongorestore\fP outputs the following messages: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-07\-08T14:38:15.142\-0400 preparing collections to restore from -2019\-07\-08T14:38:15.142\-0400 0 document(s) restored successfully. 0 document(s) failed to restore. -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For more examples, see \fI\%Examples\fP\&. -.sp -For more information on the options and arguments, see -\fI\%Options\fP\&. -.SH BEHAVIOR -.SS Insert Only -.sp -\fI\%mongorestore\fP can create a new database or add data to an -existing database. However, \fI\%mongorestore\fP performs inserts -only and does not perform updates. That is, if restoring documents to -an existing database and collection and existing documents have the -same value \fB_id\fP field as the to\-be\-restored documents, -\fI\%mongorestore\fP will \fInot\fP overwrite those documents. -.SS Rebuild Indexes -.sp -\fI\%mongorestore\fP recreates indexes recorded by -\fBmongodump\fP\&. -.sp -\fBNOTE:\fP -.INDENT 0.0 -.INDENT 3.5 -For MongoDB 2.6 through MongoDB versions with -\fBfeatureCompatibilityVersion\fP (fCV) set to \fB"4.0"\fP or earlier, -creating indexes will \fBerror if an -index key in an existing document exceeds the limit\fP\&. -.sp -To avoid this issue, consider using hashed indexes or indexing a -computed value instead. If you want to resolve the index issue after -restoring the data, you can disable the default index key length -validation on the target database by setting the \fBmongod\fP -instance\(aqs \fBfailIndexKeyTooLong\fP parameter to false. -.UNINDENT -.UNINDENT -.SS Version Compatibility -.sp -The data format used by \fBmongodump\fP from version 2.2 or -later is \fIincompatible\fP with earlier versions of \fBmongod\fP\&. -Do not use recent versions of \fBmongodump\fP to back up older -data stores. -.SS Exclude \fBsystem.profile\fP Collection -.sp -\fI\%mongorestore\fP does not restore the \fBsystem.profile\fP collection data. -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongorestore\&. mongorestore -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SS Write Concern -.sp -Starting in version 4.2, if you specify write concern in both the -\fI\%\-\-writeConcern\fP option and the -\fI\%\-\-uri connection string\fP option, the -\fI\%\-\-writeConcern\fP value overrides -the write concern specified in the URI string. -.sp -In earlier versions, the two options are incompatible. -.SH REQUIRED ACCESS -.sp -To restore data to a MongoDB deployment that has access control enabled, the \fBrestore\fP role provides -access to restore any database if the backup data does not include -\fBsystem.profile\fP collection data. -.sp -If the backup data includes \fBsystem.profile\fP collection data and the target database -does not contain the \fBsystem.profile\fP -collection, \fI\%mongorestore\fP attempts to create the collection -even though the program does not actually restore \fBsystem.profile\fP -documents. As such, the user requires additional privileges to perform -\fBcreateCollection\fP and \fBconvertToCapped\fP -actions on the \fBsystem.profile\fP -collection for a database. -.sp -As of MongoDB 3.2.11, you can run \fI\%mongorestore\fP with -\fI\%\-\-oplogReplay\fP if you have the -\fBrestore\fP role. To replay the oplog on versions of MongoDB -3.2.10 and earlier, you must create a -user\-defined role that has -\fBanyAction\fP on resource\-anyresource and grant only -to users who must run \fI\%mongorestore\fP with -\fI\%\-\-oplogReplay\fP\&. -.SH OPTIONS -.sp -Changed in version 3.0.0: \fI\%mongorestore\fP removed the \fB\-\-filter\fP, \fB\-\-dbpath\fP, and the -\fB\-\-noobjcheck\fP options. - -.INDENT 0.0 -.TP -.B mongorestore -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongorestore\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongorestore\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongorestore\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongorestore\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, specify the -\fBreplSetName\fP and a seed list of set members, as in -the following: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <replSetName>/<hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When specifying the replica set list format, \fBmongorestore\fP always connects to -the primary\&. -.sp -You can also connect to any single member of the replica set by specifying -the host and port of only that member: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongorestore\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongorestore\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongorestore\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongorestore\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongorestore\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongorestore\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-db <database>, \-d <database> -Specifies the destination database for \fBmongorestore\fP to restore data -\fIinto\fP when restoring from a BSON file. If the database does not -exist, \fBmongorestore\fP creates the database. For example, the following -restores the \fBsalaries\fP collection into the \fBreporting\fP database. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-db reporting dump/test/salaries.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If you do not specify \fI\%\-\-db\fP, \fBmongorestore\fP takes the database name -from the data files. -.sp -The use of \fI\%\-\-db\fP and \fI\%\-\-collection\fP options are -deprecated when restoring from a directory or an archive file. -Instead, to restore from an archive or a directory, see -\fI\%\-\-nsInclude\fP instead. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-db\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-collection <collection>, \-c <collection> -Specifies the name of the destination collection for \fBmongorestore\fP to -restore data \fIinto\fP when restoring from a BSON file. If -you do not specify \fI\%\-\-collection\fP, \fBmongorestore\fP takes -the collection name from the input filename. If the input file has an -extension, MongoDB omits the extension of the file from the collection -name. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-db reporting \-\-collection employeesalaries dump/test/salaries.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The use of \fI\%\-\-db\fP and \fI\%\-\-collection\fP options are -deprecated when restoring from a directory or an archive file. -Instead, to restore from an archive or a directory, see -\fI\%\-\-nsInclude\fP instead. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-nsExclude <namespace pattern> -New in version 3.4. - -.sp -Specifies a namespace pattern (e.g. \fB"test.myCollection"\fP, -\fB"reporting.*"\fP, \fB"dept*.bar"\fP) to \fIexclude\fP the matching -namespaces from the restore. In the pattern, you can use asterisks -\fB*\fP as \fIwild cards\fP\&. For an example of the wildcard pattern, see -\fI\%Restore Collections Using Wild Cards\fP\&. -.sp -You can specify \fI\%\-\-nsExclude\fP multiple times to exclude multiple namespace -patterns. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-nsInclude <namespace pattern> -New in version 3.4. - -.sp -Specifies a namespace pattern (e.g. \fB"test.myCollection"\fP, -\fB"reporting.*"\fP, \fB"dept*.bar"\fP) to restore only the namespaces -that match the pattern. In the pattern, you can use asterisks \fB*\fP -as \fIwild cards\fP\&. For an example of the wildcard pattern, see -\fI\%Restore Collections Using Wild Cards\fP\&. -.sp -You can specify \fI\%\-\-nsInclude\fP multiple times to include multiple namespace -patterns. -.sp -If source directory or file (i.e. the directory/file from which you -are restoring the data) does not contain data files that match the -namespace pattern, no data will be restored. -.sp -For collection names that contain non\-ascii characters, -\fBmongodump\fP outputs the corresponding filenames with -percent\-encoded names. However, to restore these collections, do not -use the encoded names. Instead, use the namespace with the non\-ascii -characters. -.sp -For example, if the dump directory contains -\fBdump/test/caf%C3%A9s.bson\fP, specify \fB\-\-nsInclude "test.cafés"\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-nsFrom <namespace pattern> -New in version 3.4. - -.sp -Use with \fI\%\-\-nsTo\fP to rename a namespace during the -restore operation. \fI\%\-\-nsFrom\fP specifies the collection in the -dump file, while \fI\%\-\-nsTo\fP specifies the name that should be -used in the restored database. -.sp -\fI\%\-\-nsFrom\fP accepts a \fInamespace pattern\fP as its argument. The namespace -pattern permits \fI\%\-\-nsFrom\fP to refer to any namespace that matches the -specified pattern. \fI\%mongorestore\fP matches the smallest valid occurence -of the namespace pattern. -.sp -For simple replacements, use asterisks (\fB*\fP) as wild cards. -Escape all literal asterisks and backslashes with a backslash. -Replacements correspond linearly to matches: each asterisk in -\fB\-\-nsFrom\fP must correspond to an asterisk in \fB\-\-nsTo\fP, and the -first asterisk in \fB\-\-nsFrom\fP matches the first asterisk in \fBnsTo\fP\&. -.sp -For more complex replacements, use dollar signs to delimit a "wild -card" variable to use in the replacement. -\fI\%Change Collections\(aq Namespaces during Restore\fP provides an example of complex -replacements with dollar sign\-delimited wild cards. -.sp -Unlike replacements with asterisks, replacements with dollar -sign\-delimited wild cards do \fBnot\fP need to be linear. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-nsTo <namespace pattern> -New in version 3.4. - -.sp -Use with \fI\%\-\-nsFrom\fP to rename a namespace during the -restore operation. \fI\%\-\-nsTo\fP specifies the new collection -name to use in the restored database, while -\fI\%\-\-nsFrom\fP specifies the name in the dump file. -.sp -\fI\%\-\-nsTo\fP accepts a \fInamespace pattern\fP as its argument. The namespace -pattern permits \fI\%\-\-nsTo\fP to refer to any namespace that matches the -specified pattern. \fI\%mongorestore\fP matches the smallest valid occurence -of the namespace pattern. -.sp -For simple replacements, use asterisks (\fB*\fP) as wild cards. -Escape all literal asterisks and backslashes with a backslash. -Replacements correspond linearly to matches: each asterisk in -\fB\-\-nsFrom\fP must correspond to an asterisk in \fB\-\-nsTo\fP, and the -first asterisk in \fB\-\-nsFrom\fP matches the first asterisk in \fBnsTo\fP\&. -.sp -For more complex replacements, use dollar signs to delimit a "wild -card" variable to use in the replacement. -\fI\%Change Collections\(aq Namespaces during Restore\fP provides an example of complex -replacements with dollar sign\-delimited wild cards. -.sp -Unlike replacements with asterisks, replacements with dollar -sign\-delimited wild cards do \fBnot\fP need to be linear. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-objcheck -Forces \fBmongorestore\fP to validate all requests from clients -upon receipt to ensure that clients never insert invalid documents into -the database. For objects with a high degree of sub\-document nesting, -\fI\%\-\-objcheck\fP can have a small impact on performance. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-drop -Before restoring the collections from the dumped backup, drops the -collections from the target database. \fI\%\-\-drop\fP does not drop -collections that are not in the backup. -.sp -When the restore includes the \fBadmin\fP database, \fBmongorestore\fP with -\fI\%\-\-drop\fP removes all user credentials and replaces them with the -users defined in the dump file. Therefore, in systems with -\fBauthorization\fP enabled, \fBmongorestore\fP must be able -to authenticate to an existing user \fIand\fP to a user defined in the -dump file. If \fBmongorestore\fP can\(aqt authenticate to a user defined in the -dump file, the restoration process will fail, leaving an empty -database. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-dryRun -New in version 3.4. - -.sp -Runs \fBmongorestore\fP without actually importing any data, returning the -\fBmongorestore\fP summary information. Use with \fB\-\-verbose\fP to produce -more detailed summary information. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-oplogReplay -After restoring the database dump, replays the oplog entries -from a bson file. -When used in conjunction with \fBmongodump \-\-oplog\fP, -\fB~bin.mongorestore \-\-oplogReplay\fP -restores the database to the point\-in\-time backup captured with the -\fBmongodump \-\-oplog\fP command. -.sp -\fBmongorestore\fP searches for any valid source for the bson file -in the following locations: -.INDENT 7.0 -.IP \(bu 2 -The top level of the dump directory, as in the case of a dump created -with \fBmongodump \-\-oplog\fP\&. -.IP \(bu 2 -The path specified by \fI\%\-\-oplogFile\fP\&. -.IP \(bu 2 -\fB<dump\-directory>/local/oplog.rs.bson\fP, as in the case of a dump -of the \fBoplog.rs\fP collection in the \fBlocal\fP database -on a \fBmongod\fP that is a member of a replica set. -.UNINDENT -.sp -If there is an \fBoplog.bson\fP file at the top level of the dump -directory \fBand\fP a path specified by \fI\%\-\-oplogFile\fP, -\fBmongorestore\fP returns an error. -.sp -If there is an \fBoplog.bson\fP file at the top level of the dump directory, -\fBmongorestore\fP restores that file as the oplog. If there are also bson -files in the \fBdump/local\fP directory, \fBmongorestore\fP restores them like -normal collections. -.sp -If you specify an oplog file using \fI\%\-\-oplogFile\fP, -\fBmongorestore\fP restores that file as the oplog. If there are also bson -files in the \fBdump/local\fP directory, \fBmongorestore\fP restores them like -normal collections. -.sp -For an example of \fI\%\-\-oplogReplay\fP, see backup\-restore\-oplogreplay\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -When using \fI\%mongorestore\fP with \fI\%\-\-oplogReplay\fP to restore -a replica set, you must -restore a full dump of a replica set member created -using \fB~bin.mongodump \-\-oplog\fP\&. -\fI\%mongorestore\fP with \fI\%\-\-oplogReplay\fP fails if you use any of -the following options to limit the data be restored: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-db\fP -.IP \(bu 2 -\fI\%\-\-collection\fP -.IP \(bu 2 -\fI\%\-\-nsInclude\fP -.IP \(bu 2 -\fI\%\-\-nsExclude\fP -.UNINDENT -.UNINDENT -.UNINDENT -.sp -\fBSEE ALSO:\fP -.INDENT 7.0 -.INDENT 3.5 -\fI\%mongorestore Required Access\fP -.UNINDENT -.UNINDENT -.sp -\fBSEE ALSO:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBmongodump \-\-oplog\fP -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-oplogLimit <timestamp> -Prevents \fBmongorestore\fP from applying oplog entries -with timestamp newer than or equal to \fB<timestamp>\fP\&. Specify -\fB<timestamp>\fP values in the form of \fB<time_t>:<ordinal>\fP, where -\fB<time_t>\fP is the seconds since the UNIX epoch, and \fB<ordinal>\fP -represents a counter of operations in the oplog that occurred in the -specified second. -.sp -You must use \fI\%\-\-oplogLimit\fP in conjunction with the -\fI\%\-\-oplogReplay\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-oplogFile <path> -New in version 3.4. - -.sp -Specifies the path to the oplog file containing oplog data for the -restore. Use with \fI\%\-\-oplogReplay\fP\&. -.sp -If you specify \fI\%\-\-oplogFile\fP and there is an \fBoplog.bson\fP -file at the top level of the dump directory, \fBmongorestore\fP returns an -error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-keepIndexVersion -Prevents \fBmongorestore\fP from upgrading the index to the latest -version during the restoration process. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-noIndexRestore -Prevents \fBmongorestore\fP from restoring and building indexes as -specified in the corresponding \fBmongodump\fP output. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-noOptionsRestore -Prevents \fBmongorestore\fP from setting the collection options, -such as those specified by the \fBcollMod\fP database -command, on restored collections. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-restoreDbUsersAndRoles -Restore user and role definitions for the given database. See -/reference/system\-roles\-collection and -/reference/system\-users\-collection for more information. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-writeConcern <document> -\fIDefault\fP: majority -.sp -Specifies the write concern for each write operation that \fBmongorestore\fP -performs. -.sp -Specify the write concern as a document with w options: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-writeConcern "{w:\(aqmajority\(aq}" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the write concern is also included in the \fI\%\-\-uri -connection string\fP, the command\-line -\fI\%\-\-writeConcern\fP overrides the write concern specified in -the URI string. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-maintainInsertionOrder -\fIDefault\fP: False -.sp -If specified, \fBmongorestore\fP inserts the documents in the order of -their appearance in the input source, otherwise \fBmongorestore\fP may -perform the insertions in an arbitrary order. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-numParallelCollections int, \-j int -\fIDefault\fP: 4 -.sp -Number of collections \fBmongorestore\fP should restore -in parallel. -.sp -If you specify \fB\-j\fP when restoring a \fIsingle\fP collection, \fB\-j\fP -maps to the \fI\%\-\-numInsertionWorkersPerCollection\fP option rather than -\fI\%\-\-numParallelCollections\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-numInsertionWorkersPerCollection int -\fIDefault\fP: 1 -.sp -New in version 3.0.0. - -.sp -Specifies the number of insertion workers to run concurrently per collection. -.sp -For large imports, increasing the number of insertion workers -may increase the speed of the import. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-stopOnError -New in version 3.0. - -.sp -Forces \fBmongorestore\fP to halt the restore when it encounters an -error. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-bypassDocumentValidation -Enables \fBmongorestore\fP to bypass document validation -during the operation. This lets you insert documents that do not -meet the validation requirements. -.sp -New in version 3.2.1. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gzip -New in version 3.2. - -.sp -Restores from compressed files or data stream created by -\fB~bin.mongodump \-\-gzip\fP -.sp -To restore from a dump directory that contains compressed files, run -\fI\%mongorestore\fP with the \fI\%\-\-gzip\fP option. -.sp -To restore from a compressed archive file, run \fI\%mongorestore\fP with -both the \fI\%\-\-gzip\fP and the \fI\-\-archive\fP options. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-archive <=file|null> -New in version 3.2. - -.sp -Restores from an archive file or from the standard input (\fBstdin\fP). -.sp -To restore from an archive file, run \fBmongorestore\fP with the \fB\-\-archive\fP -option and the archive filename. -.sp -To restore from the standard input, run \fBmongorestore\fP with the -\fB\-\-archive\fP option but \fIomit\fP the filename. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -.INDENT 0.0 -.INDENT 3.5 -.INDENT 0.0 -.IP \(bu 2 -You cannot use the \fB\-\-archive\fP option with the \fI\%\-\-dir\fP -option. -.IP \(bu 2 -If you use the \fI\%\-\-archive\fP option with the \fI\%<path>\fP -parameter, \fBmongorestore\fP ignores \fI\%<path>\fP parameter. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.IP \(bu 2 -\fBmongorestore\fP still supports the positional \fB\-\fP parameter to -restore a \fIsingle\fP collection from the standard input. -.UNINDENT -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B <path> -The directory path or BSON file name from which to restore data. -.sp -You cannot specify both the \fB<path>\fP argument and the \fB\-\-dir\fP -option, which also specifies the dump directory, to \fBmongorestore\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-dir string -Specifies the dump directory. -.INDENT 7.0 -.IP \(bu 2 -You cannot specify both the \fB\-\-dir\fP option and the \fB<path>\fP -argument, which also specifies the dump directory, to \fBmongorestore\fP\&. -.IP \(bu 2 -You cannot use the \fB\-\-archive\fP option with the \fB\-\-dir\fP option. -.UNINDENT -.UNINDENT -.SH EXAMPLES -.SS Restore with Access Control -.sp -In the following example, \fI\%mongorestore\fP restores from -\fB/opt/backup/mongodump\-2011\-10\-24\fP to a \fBmongod\fP -instance running on port \fB27017\fP on the host -\fBmongodb1.example.net\fP\&. The \fI\%\-\-uri\fP -string omits the user\(aqs password to have \fI\%mongorestore\fP -prompt for the password. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-uri "mongodb://user@mongodb1.example.net:27017/?authSource=admin" /opt/backup/mongodump\-2011\-10\-24 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Alternatively, you can specify the host, port, username, and -authentication database using \fI\%\-\-host\fP, -\fI\%\-\-port\fP, \fI\%\-\-username\fP, and \fI\%\-\-authenticationDatabase\fP\&. Omit \fI\%\-\-password\fP to have \fI\%mongorestore\fP prompt for the password: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-host mongodb1.example.net \-\-port 27017 \-\-username user \-\-authenticationDatabase=admin /opt/backup/mongodump\-2011\-10\-24 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore a Collection -.sp -New in version 3.4. - -.sp -To restore a specific collection, use \fI\%\-\-nsInclude\fP, passing in the full namespace -(\fB<database>.<collection>\fP) of the collection. -.sp -For example, the following restores the collection named -\fBpurchaseorders\fP in the database \fBtest\fP from the corresponding -files located in the \fBdump/\fP directory. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-nsInclude test.purchaseorders dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fI\%mongorestore\fP outputs the results, including the -number of documents restored: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-06\-28T19:23:42.858\-0400 preparing collections to restore from -2019\-06\-28T19:23:42.858\-0400 reading metadata for test.purchaseorders from dump/test/purchaseorders.metadata.json -2019\-06\-28T19:23:42.893\-0400 restoring test.purchaseorders from dump/test/purchaseorders.bson -2019\-06\-28T19:23:42.896\-0400 restoring indexes for collection test.purchaseorders from metadata -2019\-06\-28T19:23:42.991\-0400 finished restoring test.purchaseorders (6 documents, 0 failures) -2019\-06\-28T19:23:42.991\-0400 6 document(s) restored successfully. 0 document(s) failed to restore. -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the \fBdump/\fP directory does not contain the corresponding data -files for the specified namespace, no data will be restored: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-07\-08T14:39:57.121\-0400 preparing collections to restore from -2019\-07\-08T14:39:57.121\-0400 0 document(s) restored successfully. 0 document(s) failed to restore. -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Alternatively, you can restore a specific collection using the -\fI\%\-\-db\fP, \fI\%\-\-collection\fP, and a \fB\&.bson\fP file: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-db test \-\-collection purchaseorders dump/test/purchaseorders.bson -.ft P -.fi -.UNINDENT -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-06\-30T12:21:44.777\-0400 checking for collection data in dump/test/purchaseorders.bson -2019\-06\-30T12:21:44.779\-0400 reading metadata for test.purchaseorders from dump/test/purchaseorders.metadata.json -2019\-06\-30T12:21:44.813\-0400 restoring test.purchaseorders from dump/test/purchaseorders.bson -2019\-06\-30T12:21:44.881\-0400 restoring indexes for collection test.purchaseorders from metadata -2019\-06\-30T12:21:44.987\-0400 finished restoring test.purchaseorders (6 documents, 0 failures) -2019\-06\-30T12:21:44.987\-0400 6 document(s) restored successfully. 0 document(s) failed to restore. -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore Collections Using Wild Cards -.sp -New in version 3.4. - -.sp -\fI\%\-\-nsInclude\fP and -\fI\%\-\-nsExclude\fP support specifying the -namespaces you wish to include or exclude from a -restore operation using asterisks as \fIwild cards\fP\&. -.sp -The following example restores the documents in the \fBdump/\fP -sub\-directory of the current directory that match the specified -namespace pattern. The \fI\%\-\-nsInclude\fP -statement specifies to only restore documents in the \fBtransactions\fP -database while \fI\%\-\-nsExclude\fP -instructs \fI\%mongorestore\fP to exclude collections whose -names end with \fB_dev\fP\&. \fI\%mongorestore\fP restores data to -the \fBmongod\fP instance running on the localhost interface -on port \fB27017\fP\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-nsInclude \(aqtransactions.*\(aq \-\-nsExclude \(aqtransactions.*_dev\(aq dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Change Collections\(aq Namespaces during Restore -.sp -New in version 3.4. - -.sp -MongoDB 3.4 added the \fI\%\-\-nsFrom\fP and -\fI\%\-\-nsTo\fP options, which enable you to -change the namespace of a collection that you are restoring. -\fI\%\-\-nsFrom\fP and \fI\%\-\-nsTo\fP support using asterisks as wild cards \fIand\fP -support using dollar signs to delimit "wild card" variables to use in -the replacement. -.sp -Consider a database \fBdata\fP that you have exported to a \fBdump/\fP -directory using \fBmongodump\fP\&. The \fBdata\fP database -contains the following collections: -.INDENT 0.0 -.IP \(bu 2 -\fBsales_customer1\fP -.IP \(bu 2 -\fBsales_customer2\fP -.IP \(bu 2 -\fBsales_customer3\fP -.IP \(bu 2 -\fBusers_customer1\fP -.IP \(bu 2 -\fBusers_customer2\fP -.IP \(bu 2 -\fBusers_customer3\fP -.UNINDENT -.sp -Using \fI\%\-\-nsFrom\fP and \fI\%\-\-nsTo\fP, you can restore the data into different -namespaces. The following operation -.INDENT 0.0 -.IP \(bu 2 -restores the \fBsales_<customerName>\fP collections in the \fBdata\fP -database to \fBsales\fP collections in the \fB<customerName>\fP database, -and -.IP \(bu 2 -restores the \fBusers_<customerName>\fP collections to \fBusers\fP -collections in the \fB<customerName>\fP database. -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-nsInclude \(aqdata.*\(aq \-\-nsFrom \(aqdata.$prefix$_$customer$\(aq \-\-nsTo \(aq$customer$.$prefix$\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore from an Archive File -.sp -To restore from an archive file, run \fBrestore\fP with the new -\fB\-\-archive\fP option and the archive filename. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-archive=test.20150715.archive -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore a Database from an Archive File -.sp -New in version 3.2. - -.sp -To restore from an archive file, run \fBrestore\fP with the new -\fB\-\-archive\fP option and the archive filename. For example, the -following operation restores the \fBtest\fP database from the file -\fBtest.20150715.archive\fP\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-archive=test.20150715.archive \-\-nsInclude "test.*" -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore from Compressed Data -.sp -New in version 3.2: With the \fB\-\-gzip\fP option, \fI\%mongorestore\fP can restore from -compressed files or data stream created by \fBmongodump\fP\&. - -.sp -To restore from a dump directory that contains compressed files, run -\fI\%mongorestore\fP with the \fI\%\-\-gzip\fP\&. For example, the following operation restores the \fBtest\fP -database from the compressed files located in the default \fBdump\fP -directory: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-gzip \-\-nsInclude "test.*" dump/ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To restore from a compressed archive file, run -\fI\%mongorestore\fP with the \fI\%\-\-gzip\fP option and the \fI\%\-\-archive\fP -option. For example, the following operation restores the \fBtest\fP -database from the archive file \fBtest.20150715.gz\fP\&. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongorestore \-\-gzip \-\-archive=test.20150715.gz \-\-nsInclude "test.*" -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Restore a Database from Standard Input -.sp -New in version 3.2. - -.sp -To restore from the standard input, run \fI\%mongorestore\fP -with the \fI\%\-\-archive\fP option but \fIomit\fP -the filename. For example: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongodump \-\-archive \-\-db test \-\-port 27017 | mongorestore \-\-archive \-\-port 27018 -.ft P -.fi -.UNINDENT -.UNINDENT -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongostat.1 b/debian/mongostat.1 deleted file mode 100644 index 68d3c233fbe..00000000000 --- a/debian/mongostat.1 +++ /dev/null @@ -1,1243 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOSTAT" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongostat \- MongoDB Use Statistics -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Synopsis\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Fields\fP -.IP \(bu 2 -\fI\%Examples\fP -.IP \(bu 2 -\fI\%Additional Information\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongostat\&. -.UNINDENT -.UNINDENT -.SH SYNOPSIS -.sp -The \fI\%mongostat\fP utility provides a quick overview of the -status of a currently running \fBmongod\fP -or \fBmongos\fP -instance. \fI\%mongostat\fP is functionally similar to the -UNIX/Linux file system utility \fBvmstat\fP, but provides data regarding -\fBmongod\fP and \fBmongos\fP instances. -.sp -Run \fI\%mongostat\fP from the system command line, not the \fBmongo\fP shell. -.SH REQUIRED ACCESS -.sp -In order to connect to a \fBmongod\fP that enforces authorization -with the \fB\-\-auth\fP option, specify the -\fI\%\-\-username\fP and \fI\%\-\-password\fP options, and the connecting user must have the -\fBserverStatus\fP privilege action on the cluster resources. -.sp -The built\-in role \fBclusterMonitor\fP provides this privilege as -well as other privileges. To create a role with just the privilege to -run \fI\%mongostat\fP, see create\-role\-for\-mongostat\&. -.SH BEHAVIOR -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongostat\&. mongostat -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SH OPTIONS -.INDENT 0.0 -.TP -.B mongostat -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongostat\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongostat\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongostat\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, you can specify the set member or -members to report on, as in the following (see also the -\fB\-\-discover\fP flag): -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongostat\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongostat\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongostat\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongostat\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongostat\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongostat\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.sp -\fI\%\-\-authenticationDatabase\fP is required for \fBmongod\fP -and \fBmongos\fP instances that use authentication\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongostat\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-humanReadable boolean -\fIDefault\fP: True -.sp -New in version 3.4. - -.sp -When \fBtrue\fP, \fBmongostat\fP formats dates and quantity values for -easier reading, as in the following sample output: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn time - 991 *0 *0 *0 0 2|0 3.4% 4.5% 0 2.90G 297M 0|0 0|0 12.9m 84.2k 2 Oct 6 09:45:37.478 - 989 *0 *0 *0 0 2|0 3.6% 4.7% 0 2.91G 310M 0|0 0|0 12.9m 84.1k 2 Oct 6 09:45:38.476 - 988 *0 *0 *0 0 1|0 3.7% 4.8% 0 2.92G 323M 0|0 0|0 12.8m 83.8k 2 Oct 6 09:45:39.481 - 976 *0 *0 *0 0 2|0 3.9% 5.0% 0 2.94G 335M 0|0 0|0 12.7m 83.7k 2 Oct 6 09:45:40.476 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When \fBfalse\fP, \fBmongostat\fP returns the raw data, as in the following -sample output: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn time - 992 *0 *0 *0 0 2|0 1.3 2.4 0 2941255680 149946368 0|0 0|0 12913607 84271 2 2016\-10\-06T09:45:25\-04:00 - 989 *0 *0 *0 0 1|0 1.5 2.6 0 2974810112 163577856 0|0 0|0 12873225 84087 2 2016\-10\-06T09:45:26\-04:00 - 996 *0 *0 *0 0 1|0 1.6 2.8 0 2972712960 177209344 0|0 0|0 12955423 84345 2 2016\-10\-06T09:45:27\-04:00 - 987 *0 *0 *0 0 1|0 1.8 2.9 0 2989490176 190840832 0|0 0|0 12861852 84008 2 2016\-10\-06T09:45:28\-04:00 -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-o <field list> -New in version 3.4. - -.sp -When specified, \fBmongostat\fP includes \fBonly\fP the specified fields -in the \fBmongostat\fP output. -.sp -Use dot notation to specify -\fBserverStatus fields\fP, as in -\fBmetrics.document.inserted\fP\&. -.sp -To specify a custom name for a field, use \fB<field>=<customName>\fP, -as in: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-o \(aqhost=H,time=T,version=MongoDB Version\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fI\%\-o\fP supports the following methods to modify the information -returned for a given serverStatus field: -.INDENT 7.0 -.TP -.B rate() -Use \fI\%\&.rate()\fP to view the rate per second at which a -serverStatus field is changing from \fI\%mongostat\fP call to -call. -.sp -\fI\%View Rate of Change for a Field with .rate()\fP illustrates how to use -\fI\%mongostat\fP with \fI\%\-o\fP and the \fI\%\&.rate()\fP -method. -.UNINDENT -.INDENT 7.0 -.TP -.B diff() -Use \fI\%\&.diff()\fP to view how much a serverStatus field has -changed since the previous \fI\%mongostat\fP call. The interval -between calls is specified by \fB<sleeptime>\fP\&. -.sp -\fI\%View Field Changes with .diff()\fP illustrates how to use -\fI\%mongostat\fP with \fI\%\-o\fP and the \fI\%\&.diff()\fP -method. -.UNINDENT -.sp -\fBmongostat\fP supports specifying \fIeither\fP \fI\%\-o\fP or \fI\%\-O\fP: -you cannot include both options. -.sp -See \fI\%Specify mongostat Output Fields\fP for an example of -\fI\%\-o\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-O <field list> -New in version 3.4. - -.sp -When specified, \fBmongostat\fP includes the specified -\fBserverStatus\fP fields after the default \fBmongostat\fP output. -.sp -Use dot notation to specify -\fBserverStatus fields\fP, as in -\fBmetrics.document.inserted\fP\&. -.sp -To specify a custom name for a field, use \fB<field>=<customName>\fP, -as in: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-O host=H,time=T -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fBmongostat\fP supports specifying \fIeither\fP \fI\%\-O\fP or \fI\%\-o\fP: -you cannot include both options. -.sp -See \fI\%Add Fields to mongostat Output\fP for an example of -\fI\%\-O\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-noheaders -Disables the output of column or field names. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-rowcount <number>, \-n <number> -Controls the number of rows to output. Use in conjunction with -the \fBsleeptime\fP argument to control the duration of a -\fI\%mongostat\fP operation. -.sp -Unless \fI\%\-\-rowcount\fP is specified, \fI\%mongostat\fP -will return an infinite number of rows (e.g. value of \fB0\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-discover -Discovers and reports on statistics from all members of a replica -set or sharded cluster\&. When connected to any member of a -replica set, \fI\%\-\-discover\fP all non\-hidden members of the replica set. When connected to a \fBmongos\fP, -\fI\%mongostat\fP will return data from all shards in -the cluster. If a replica set provides a shard in the sharded cluster, -\fI\%mongostat\fP will report on non\-hidden members of that replica -set. -.sp -The \fI\%mongostat \-\-host\fP option is not required but -potentially useful in this case. -.sp -Changed in version 2.6: When running with \fI\%\-\-discover\fP, \fI\%mongostat\fP now -respects \fI\%\-\-rowcount\fP\&. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-http -Configures \fI\%mongostat\fP to collect data using the HTTP interface -rather than a raw database connection. -.sp -Changed in version 3.6: MongoDB 3.6 removes the deprecated HTTP interface and REST API to -MongoDB. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-all -Configures \fI\%mongostat\fP to return all optional \fI\%fields\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-json -New in version 3.0.0. - -.sp -Returns output for \fBmongostat\fP in JSON format. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-interactive -New in version 3.4. - -.sp -Display \fBmongostat\fP output in an interactive non\-scrolling interface -rather than the default scrolling output. -.sp -\fI\%\-\-interactive\fP is not available with the \fI\%\-\-json\fP -option. -.sp -See: \fI\%View Statistics in an Interactive Interface\fP for an example of \fI\%\-\-interactive\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B <sleeptime> -\fIDefault\fP: 1 -.sp -The final \fBmongostat\fP argument is the length of time, in seconds, that -\fI\%mongostat\fP waits in between calls. By default \fI\%mongostat\fP -returns one call every second. -.sp -\fI\%mongostat\fP returns values that reflect the operations -over a 1 second period. For values of \fB<sleeptime>\fP greater -than 1, \fI\%mongostat\fP averages data to reflect average -operations per second. -.UNINDENT -.SH FIELDS -.sp -\fI\%mongostat\fP returns values that reflect the operations over a -1 second period. When \fBmongostat <sleeptime>\fP has a value -greater than 1, \fI\%mongostat\fP averages the statistics to reflect -average operations per second. -.sp -\fI\%mongostat\fP outputs the following fields: -.INDENT 0.0 -.TP -.B inserts -The number of objects inserted into the database per second. If -followed by an asterisk (e.g. \fB*\fP), the datum refers to a -replicated operation. -.UNINDENT -.INDENT 0.0 -.TP -.B query -The number of query operations per second. -.UNINDENT -.INDENT 0.0 -.TP -.B update -The number of update operations per second. -.UNINDENT -.INDENT 0.0 -.TP -.B delete -The number of delete operations per second. -.UNINDENT -.INDENT 0.0 -.TP -.B getmore -The number of get more (i.e. cursor batch) operations per second. -.UNINDENT -.INDENT 0.0 -.TP -.B command -The number of commands per second. On -secondary systems, \fI\%mongostat\fP presents two values -separated by a pipe character (e.g. \fB|\fP), in the form of -\fBlocal|replicated\fP commands. -.UNINDENT -.INDENT 0.0 -.TP -.B flushes -Changed in version 3.0. - -.sp -For the storage\-wiredtiger, \fBflushes\fP refers to the number -of WiredTiger checkpoints triggered between each polling interval. -.UNINDENT -.INDENT 0.0 -.TP -.B dirty -New in version 3.0. - -.sp -Only for storage\-wiredtiger\&. The percentage of the WiredTiger -cache with dirty bytes, calculated by -\fBwiredTiger.cache.tracked dirty bytes in the cache\fP -/ \fBwiredTiger.cache.maximum bytes configured\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B used -New in version 3.0. - -.sp -Only for storage\-wiredtiger\&. The percentage of the WiredTiger -cache that is in use, calculated by -\fBwiredTiger.cache.bytes currently in the cache\fP / -\fBwiredTiger.cache.maximum bytes configured\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B vsize -The amount of virtual memory in megabytes used by the process at -the time of the last \fI\%mongostat\fP call. -.UNINDENT -.INDENT 0.0 -.TP -.B res -The amount of resident memory in megabytes used by the process at -the time of the last \fI\%mongostat\fP call. -.UNINDENT -.INDENT 0.0 -.TP -.B locked -Changed in version 3.0: Only appears when \fI\%mongostat\fP runs against pre\-3.0 -versions of MongoDB instances. - -.sp -The percent of time in a global write lock. -.UNINDENT -.INDENT 0.0 -.TP -.B qr -The length of the queue of clients waiting to read data from the -MongoDB instance. -.UNINDENT -.INDENT 0.0 -.TP -.B qw -The length of the queue of clients waiting to write data from the -MongoDB instance. -.UNINDENT -.INDENT 0.0 -.TP -.B ar -The number of active clients performing read operations. -.UNINDENT -.INDENT 0.0 -.TP -.B aw -The number of active clients performing write operations. -.UNINDENT -.INDENT 0.0 -.TP -.B netIn -The amount of network traffic, in \fIbytes\fP, received by the MongoDB instance. -.sp -This includes traffic from \fI\%mongostat\fP itself. -.UNINDENT -.INDENT 0.0 -.TP -.B netOut -The amount of network traffic, in \fIbytes\fP, sent by the MongoDB instance. -.sp -This includes traffic from \fI\%mongostat\fP itself. -.UNINDENT -.INDENT 0.0 -.TP -.B conn -The total number of open connections. -.UNINDENT -.INDENT 0.0 -.TP -.B set -The name, if applicable, of the replica set. -.UNINDENT -.INDENT 0.0 -.TP -.B repl -The replication status of the member. -.TS -center; -|l|l|. -_ -T{ -\fBValue\fP -T} T{ -\fBReplication Type\fP -T} -_ -T{ -M -T} T{ -master -T} -_ -T{ -SEC -T} T{ -secondary -T} -_ -T{ -REC -T} T{ -recovering -T} -_ -T{ -UNK -T} T{ -unknown -T} -_ -T{ -RTR -T} T{ -mongos process ("router") -T} -_ -T{ -ARB -T} T{ -arbiter -T} -_ -.TE -.UNINDENT -.SH EXAMPLES -.SS Specify \fBmongostat\fP Collection Period and Frequency -.sp -In the first example, \fI\%mongostat\fP will return data every -second for 20 seconds. \fI\%mongostat\fP collects data from the -\fBmongod\fP instance running on the localhost interface on -port 27017. All of the following invocations produce identical -behavior: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-\-rowcount 20 1 -mongostat \-\-rowcount 20 -mongostat \-n 20 1 -mongostat \-n 20 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -In the next example, \fI\%mongostat\fP returns data every 5 minutes -(or 300 seconds) for as long as the program runs. \fI\%mongostat\fP -collects data from the \fBmongod\fP instance running on the -localhost interface on port \fB27017\fP\&. The following -invocations produce identical behavior: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-\-rowcount 0 300 -mongostat \-n 0 300 -mongostat 300 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -In the following example, \fI\%mongostat\fP returns data every 5 -minutes for an hour (12 times.) \fI\%mongostat\fP collects data -from the \fBmongod\fP instance running on the localhost interface -on port 27017. The following invocations produce identical -behavior: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-\-rowcount 12 300 -mongostat \-n 12 300 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Add Fields to \fI\%mongostat\fP Output -.sp -New in version 3.4. - -.sp -\fI\%\-O\fP allows you to specify fields from -\fBserverStatus\fP output to add to the default -\fI\%mongostat\fP output. The following example adds the \fBhost\fP -and \fBversion\fP fields as well as the \fBnetwork.numRequests\fP field, -which will display as "network requests", to the default -\fI\%mongostat\fP output: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-O \(aqhost,version,network.numRequests=network requests\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fI\%mongostat\fP output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn time host version network requests - *0 *0 *0 *0 0 2|0 0.0% 0.0% 0 2.51G 19.0M 0|0 0|0 158b 39.4k 2 Oct 11 12:14:45.878 localhost:37017 3.3.14 91 - *0 *0 *0 *0 0 1|0 0.0% 0.0% 0 2.51G 19.0M 0|0 0|0 157b 39.3k 2 Oct 11 12:14:46.879 localhost:37017 3.3.14 95 - *0 *0 *0 *0 0 1|0 0.0% 0.0% 0 2.51G 19.0M 0|0 0|0 157b 39.2k 2 Oct 11 12:14:47.884 localhost:37017 3.3.14 99 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Specify \fI\%mongostat\fP Output Fields -.sp -New in version 3.4. - -.sp -\fI\%\-o\fP specifies the columns \fI\%mongostat\fP includes in its -output. You can specify any \fBserverStatus\fP field as a -\fI\%mongostat\fP output column. The following example specifies the -\fBhost\fP, \fBtime\fP, and \fBmetrics.document.inserted\fP fields: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-o \(aqhost,time,metrics.document.inserted\(aq -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The \fI\%mongostat\fP output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C - host time metrics.document.inserted -localhost:37017 Oct 11 12:21:17.370 0 -localhost:37017 Oct 11 12:21:18.371 0 -localhost:37017 Oct 11 12:21:19.371 0 -localhost:37017 Oct 11 12:21:20.368 0 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS View Rate of Change for a Field with \fI\%\&.rate()\fP -.sp -New in version 3.4. - -.sp -\fI\%\&.rate()\fP enables you to view the rate per second at which a -numerical field has changed from one \fI\%mongostat\fP call to the -next. For example, you can view the rate at which documents have been -inserted during an insert operation. \fI\%\&.rate()\fP can therefore -help you view the performance of your \fBmongod\fP instance. -.sp -The following example reports on the rate of change of the -\fBmetrics.document.inserted\fP \fBserverStatus\fP field. The -invocation uses \fI\%\-o\fP\(aqs ability to specify the name of an column -to label \fBmetrics.document.inserted.rate()\fP as "inserted rate" and -\fBmetrics.document.inserted\fP as "inserted": -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-o \(aqhost,mem,bits,metrics.document.inserted.rate()=inserted rate,metrics.document.inserted=inserted\(aq \-\-rowcount 5 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C - host mem.bits inserted rate inserted -localhost:37017 64 501 3455 -localhost:37017 64 967 13128 -localhost:37017 64 972 22851 -localhost:37017 64 214 25000 -localhost:37017 64 0 25000 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS View Field Changes with \fI\%\&.diff()\fP -.sp -New in version 3.4. - -.sp -\fI\%\&.diff()\fP returns the difference between the current -\fBserverStatus\fP field value and the value from the previous -\fI\%mongostat\fP call. The following example returns statistics on -the number of documents being inserted into a collection: \fBinserted -diff\fP is the difference in the -\fBmetrics.document.inserted\fP field between subsequent -calls, while \fBinserted\fP is the value of -\fBmetrics.document.inserted\fP: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-o \(aqhost,mem.bits,metrics.document.inserted.diff()=inserted diff,metrics.document.inserted=inserted\(aq \-\-rowcount 5 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The output would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C - host mem.bits inserted diff inserted -localhost:27017 64 0 25359 -localhost:27017 64 94 25453 -localhost:27017 64 938 26391 -localhost:27017 64 964 27355 -localhost:27017 64 978 28333 -.ft P -.fi -.UNINDENT -.UNINDENT -.SS View Statistics for a Replica Set or Sharded Cluster -.sp -In many cases, using the \fI\%\-\-discover\fP option -will help provide a more complete snapshot of the state of an entire -group of machines. If a \fBmongos\fP process connected to a -sharded cluster is running on port \fB27017\fP of the local -machine, you can use the following form to return statistics from all -members of the cluster: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-\-discover -.ft P -.fi -.UNINDENT -.UNINDENT -.SS View Statistics in an Interactive Interface -.sp -New in version 3.4. - -.sp -Use the \fI\%\-\-interactive\fP option to -view statistics in a non\-scrolling \fI\%ncurses\fP \-style -interactive output. The \fI\%\-\-interactive\fP option lets you highlight specific -hosts, columns, or fields to view. When combined with \fI\%\-\-discover\fP, -\fI\%\-\-interactive\fP displays statistics for all members of a -replica set or sharded cluster, as in the following example: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongostat \-\-discover \-\-interactive -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The output for a sharded cluster would then resemble: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C - host insert query update delete getmore command dirty used flushes mapped vsize res faults qrw arw net_in net_out conn set repl time -hostname.local:27018 *0 *0 *0 *0 0 1|0 0.0% 0.0% 0 3.25G 25.0M n/a 0|0 1|0 157b 43.9k 19 tic PRI Nov 2 11:44:46.439 -hostname.local:27019 *0 *0 *0 *0 0 2|0 0.0% 0.0% 0 3.18G 26.0M n/a 0|0 1|0 322b 44.4k 12 tic SEC Nov 2 11:44:46.439 -hostname.local:27020 *0 *0 *0 *0 0 2|0 0.0% 0.0% 0 3.18G 26.0M n/a 0|0 1|0 322b 44.4k 12 tic SEC Nov 2 11:44:46.439 -hostname.local:27021 2017 *0 *0 *0 826 1029|0 0.0% 0.0% 0 3.25G 31.0M n/a 0|0 1|0 1.74m 1.60m 20 tac PRI Nov 2 11:44:46.439 -hostname.local:27022 *2021 *0 *0 *0 0 2|0 0.0% 0.0% 0 3.19G 32.0M n/a 0|0 1|0 322b 44.6k 12 tac SEC Nov 2 11:44:46.438 -hostname.local:27023 *2022 *0 *0 *0 0 3|0 0.0% 0.0% 0 3.19G 33.0M n/a 0|0 1|0 323b 44.7k 12 tac SEC Nov 2 11:44:46.438 - localhost:27017 2071 *0 *0 *0 0 2073|0 0 0B 2.43G 9.00M 0 0|0 0|0 249k 130k 4 RTR Nov 2 11:44:47.429 - -Press \(aq?\(aq to toggle help -.ft P -.fi -.UNINDENT -.UNINDENT -.SH ADDITIONAL INFORMATION -.sp -For more information about monitoring MongoDB, see -/administration/monitoring\&. -.sp -For more background on other MongoDB status outputs see: -.INDENT 0.0 -.IP \(bu 2 -/reference/command/serverStatus -.IP \(bu 2 -/reference/command/replSetGetStatus -.IP \(bu 2 -/reference/command/dbStats -.IP \(bu 2 -/reference/command/collStats -.UNINDENT -.sp -For an additional utility that provides MongoDB metrics see -mongotop\&. -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. diff --git a/debian/mongotop.1 b/debian/mongotop.1 deleted file mode 100644 index fd74b566724..00000000000 --- a/debian/mongotop.1 +++ /dev/null @@ -1,921 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "MONGOTOP" "1" "Aug 16, 2019" "4.2" "mongodb-manual" -.SH NAME -mongotop \- MongoDB Activity Monitor -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SS On this page -.INDENT 0.0 -.IP \(bu 2 -\fI\%Description\fP -.IP \(bu 2 -\fI\%Syntax\fP -.IP \(bu 2 -\fI\%Required Access\fP -.IP \(bu 2 -\fI\%Behavior\fP -.IP \(bu 2 -\fI\%Options\fP -.IP \(bu 2 -\fI\%Fields\fP -.IP \(bu 2 -\fI\%Examples\fP -.IP \(bu 2 -\fI\%Additional Information\fP -.UNINDENT -.INDENT 0.0 -.INDENT 3.5 -.IP "macOS Sierra and Go 1.6 Incompatibility" -.sp -Users running on macOS Sierra require the 3.2.10 or newer version -of mongotop\&. -.UNINDENT -.UNINDENT -.SH DESCRIPTION -.sp -\fI\%mongotop\fP provides a method to track the amount of time a -MongoDB instance \fBmongod\fP spends reading and writing data. -\fI\%mongotop\fP provides statistics on a per\-collection level. -By default, \fI\%mongotop\fP returns values every second. -.sp -Run \fI\%mongotop\fP from the system command line, not the \fBmongo\fP shell. -.SH SYNTAX -.SS Default -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop [frequency] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You can run \fI\%mongotop\fP without any command\-line options to -connect to the \fBmongod\fP instance running on the localhost -port \fB27017\fP\&. By default, \fI\%mongotop\fP returns values -every second. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To have \fI\%mongotop\fP report every 30 seconds, specify the -time: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 30 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When connected to a \fBmongod\fP instance, the program reports -first on the connection and then reports on the statistics at the -configured frequency. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-04\-29T15:35:27.785\-0400 connected to: 127.0.0.1 - - ns total read write <timestamp> -<db.collection> 81802ms 0ms 81802ms -\&... -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Command Line Options -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop [options] [frequency] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -You can run \fI\%mongotop\fP with various \fI\%command\-line -options\fP\&. -.sp -For example, to connect \fI\%mongotop\fP to a -\fBmongod\fP instance running on a remote host -\fBmongodb0.example.com\fP and report every 30 seconds: -.INDENT 0.0 -.IP \(bu 2 -You can include the desired frequency of reporting (in this -example, 30 seconds) and the \fI\%\-\-uri\fP -option to specify the host and port: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 30 \-\-uri mongodb://mongodb0.example.com:27017 [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the \fBmongod\fP instance requires authentication, you -can specify the user, password, and authentication database as part -of the URI connection string: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 30 \-\-uri mongodb://user:password@mongodb0.example.com:27017/?authSource=admin [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The user running \fI\%mongotop\fP must have the -\fBserverStatus\fP and \fBtop\fP privileges. -.sp -For more information on the URI connection string, see -\fI\%\-\-uri\fP\&. -.IP \(bu 2 -Alternatively, you can use the \fI\%\-\-host\fP -and \fI\%\-\-port\fP options to specify the host -and port: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 30 \-\-host mongodb0.example.com \-\-port 27017 [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If the \fBmongod\fP instance requires authentication, you -can specify the user \fI\%\-u\fP, password -\fI\%\-p\fP, and the authentication database -\fI\%\-\-authenticationDatabase\fP\&. -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 30 \-\-host mongodb0.example.com \-\-port 27017 \-u user \-p password \-\-authenticationDatabase admin [additional options] -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -The user running \fI\%mongotop\fP must have the -\fBserverStatus\fP and \fBtop\fP privileges. -.UNINDENT -.sp -For more information on the options available, see -\fI\%Options\fP\&. -.sp -When connected to a \fBmongod\fP instance, the program reports -first on the connection and then reports on the statistics at the -configured frequency. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-04\-29T15:35:27.785\-0400 connected to: 127.0.0.1 - - ns total read write <timestamp> -<db.collection> 81802ms 0ms 81802ms -\&... -.ft P -.fi -.UNINDENT -.UNINDENT -.SH REQUIRED ACCESS -.sp -In order to connect to a \fBmongod\fP that enforces -authorization, the connecting user must have the -\fBserverStatus\fP and \fBtop\fP privileges. -.sp -The built\-in role \fBclusterMonitor\fP provides these privileges. -.SH BEHAVIOR -.SS FIPS -.sp -Starting in version 4.2, MongoDB removes the \fB\-\-sslFIPSMode\fP -option for mongotop\&. mongotop -will use FIPS compliant connections to -\fBmongod\fP/\fBmongos\fP if the -\fBmongod\fP/\fBmongos\fP instances are -configured to use FIPS mode\&. -.SH OPTIONS -.INDENT 0.0 -.TP -.B mongotop -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-help -Returns information on the options and use of \fBmongotop\fP\&. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-verbose, \-v -Increases the amount of internal reporting returned on standard output -or in log files. Increase the verbosity with the \fB\-v\fP form by -including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-quiet -Runs \fBmongotop\fP in a quiet mode that attempts to limit the amount -of output. -.sp -This option suppresses: -.INDENT 7.0 -.IP \(bu 2 -output from database commands -.IP \(bu 2 -replication activity -.IP \(bu 2 -connection accepted events -.IP \(bu 2 -connection closed events -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-version -Returns the \fBmongotop\fP release number. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-uri <connectionString> -New in version 3.4.6. - -.sp -Specify a resolvable URI -connection string (enclose in quotes) to connect to the MongoDB deployment. -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -For information on the components of the connection string, see -the Connection String URI Format documentation. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -For TLS/SSL options, use the command\-line options instead of the -URI options for TLS/SSL (Available starting in -4.2)\&. -.UNINDENT -.UNINDENT -.sp -\fBIMPORTANT:\fP -.INDENT 7.0 -.INDENT 3.5 -The following command\-line options cannot be used in conjunction -with \fI\%\-\-uri\fP option: -.INDENT 0.0 -.IP \(bu 2 -\fI\%\-\-host\fP -.IP \(bu 2 -\fI\%\-\-port\fP -.IP \(bu 2 -\fI\%\-\-username\fP -.IP \(bu 2 -\fI\%\-\-password\fP (if the -URI connection string also includes the password) -.IP \(bu 2 -\fI\%\-\-authenticationDatabase\fP -.IP \(bu 2 -\fI\%\-\-authenticationMechanism\fP -.UNINDENT -.sp -Instead, specify these options as part of your \fI\%\-\-uri\fP -connection string. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-host <hostname><:port>, \-h <hostname><:port> -\fIDefault\fP: localhost:27017 -.sp -Specifies a resolvable hostname for the \fBmongod\fP to which to -connect. By default, the \fBmongotop\fP attempts to connect to a MongoDB -instance running on the localhost on port number \fB27017\fP\&. -.sp -To connect to a replica set, specify the -\fBreplSetName\fP and a seed list of set members, as in -the following: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <replSetName>/<hostname1><:port>,<hostname2><:port>,<...> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -When specifying the replica set list format, \fBmongotop\fP always connects to -the primary\&. -.sp -You can also connect to any single member of the replica set by specifying -the host and port of only that member: -.INDENT 7.0 -.INDENT 3.5 -.sp -.nf -.ft C -\-\-host <hostname1><:port> -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: If you use IPv6 and use the \fB<address>:<port>\fP format, you must -enclose the portion of an address and port combination in -brackets (e.g. \fB[<address>]\fP). - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-host\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.sp -If connected to a replica set where the primary is not -reachable, \fBmongotop\fP returns an error message. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-port <port> -\fIDefault\fP: 27017 -.sp -Specifies the TCP port on which the MongoDB instance listens for -client connections. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-port\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ipv6 -\fIRemoved in version 3.0.\fP -.sp -Enables IPv6 support and allows \fBmongotop\fP to connect to the -MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you -had to specify \fI\%\-\-ipv6\fP to use IPv6. In MongoDB 3.0 and later, IPv6 -is always enabled. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-ssl -New in version 2.6. - -.sp -Enables connection to a \fBmongod\fP or \fBmongos\fP that has -TLS/SSL support enabled. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCAFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the root certificate chain -from the Certificate Authority. Specify the file name of the -\fB\&.pem\fP file using relative or absolute paths. -.sp -Starting in version 3.4, if \fB\-\-tlsCAFile\fP/\fBnet.tls.CAFile\fP (or -their aliases \fB\-\-sslCAFile\fP/\fBnet.ssl.CAFile\fP) is not specified -and you are not using x.509 authentication, the system\-wide CA -certificate store will be used when connecting to an TLS/SSL\-enabled -server. -.sp -To use x.509 authentication, \fB\-\-tlsCAFile\fP or \fBnet.tls.CAFile\fP -must be specified unless using \fB\-\-tlsCertificateSelector\fP or -\fB\-\-net.tls.certificateSelector\fP\&. Or if using the \fBssl\fP aliases, -\fB\-\-sslCAFile\fP or \fBnet.ssl.CAFile\fP must be specified unless using -\fB\-\-sslCertificateSelector\fP or \fBnet.ssl.certificateSelector\fP\&. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -\fBVersion 3.2 and earlier:\fP For TLS/SSL connections (\fB\-\-ssl\fP) to -\fBmongod\fP and \fBmongos\fP, if the \fBmongotop\fP runs without the -\fI\%\-\-sslCAFile\fP, \fBmongotop\fP will not attempt -to validate the server certificates. This creates a vulnerability -to expired \fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid \fBmongod\fP or -\fBmongos\fP instances. Ensure that you \fIalways\fP specify the -CA file to validate the server certificates in cases where -intrusion is a possibility. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains both the TLS/SSL certificate -and key. Specify the file name of the \fB\&.pem\fP file using relative -or absolute paths. -.sp -This option is required when using the \fI\%\-\-ssl\fP option to connect -to a \fBmongod\fP or \fBmongos\fP that has -\fBCAFile\fP enabled \fIwithout\fP -\fBallowConnectionsWithoutCertificates\fP\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslPEMKeyPassword <value> -New in version 2.6. - -.sp -Specifies the password to de\-crypt the certificate\-key file (i.e. -\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the -certificate\-key file is encrypted. In all cases, the \fBmongotop\fP will -redact the password from all logging and reporting output. -.sp -If the private key in the PEM file is encrypted and you do not specify -the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongotop\fP will prompt for a passphrase. See -ssl\-certificate\-password\&. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslCRLFile <filename> -New in version 2.6. - -.sp -Specifies the \fB\&.pem\fP file that contains the Certificate Revocation -List. Specify the file name of the \fB\&.pem\fP file using relative or -absolute paths. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidCertificates -New in version 2.6. - -.sp -Bypasses the validation checks for server certificates and allows -the use of invalid certificates. When using the -\fBallowInvalidCertificates\fP setting, MongoDB logs as a -warning the use of the invalid certificate. -.sp -Starting in MongoDB 4.0, if you specify -\fB\-\-sslAllowInvalidCertificates\fP or -\fBnet.ssl.allowInvalidCertificates: true\fP (or in MongoDB 4.2, the -alias \fB\-\-tlsAllowInvalidateCertificates\fP or -\fBnet.tls.allowInvalidCertificates: true\fP) when using x.509 -authentication, an invalid certificate is only sufficient to -establish a TLS/SSL connection but is \fIinsufficient\fP for -authentication. -.sp -# We created a separate blurb for tls in the ssl\-clients page. -.sp -\fBWARNING:\fP -.INDENT 7.0 -.INDENT 3.5 -Although available, avoid using the -\fB\-\-sslAllowInvalidCertificates\fP option if possible. If the use of -\fB\-\-sslAllowInvalidCertificates\fP is necessary, only use the option -on systems where intrusion is not possible. -.sp -If the \fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) runs with the -\fB\-\-sslAllowInvalidCertificates\fP option, the -\fBmongo\fP shell (and other -mongodb\-tools\-support\-ssl) will not attempt to validate -the server certificates. This creates a vulnerability to expired -\fBmongod\fP and \fBmongos\fP certificates as -well as to foreign processes posing as valid -\fBmongod\fP or \fBmongos\fP instances. If you -only need to disable the validation of the hostname in the -TLS/SSL certificates, see \fB\-\-sslAllowInvalidHostnames\fP\&. -.UNINDENT -.UNINDENT -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-sslAllowInvalidHostnames -New in version 3.0. - -.sp -Disables the validation of the hostnames in TLS/SSL certificates. Allows -\fBmongotop\fP to connect to MongoDB instances even if the hostname in their -certificates do not match the specified hostname. -.sp -For more information about TLS/SSL and MongoDB, see -/tutorial/configure\-ssl and -/tutorial/configure\-ssl\-clients . -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-username <username>, \-u <username> -Specifies a username with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-password\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-username\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-password <password>, \-p <password> -Specifies a password with which to authenticate to a MongoDB database -that uses authentication. Use in conjunction with the \fI\%\-\-username\fP and -\fI\%\-\-authenticationDatabase\fP options. -.sp -Changed in version 3.0.2: To prompt the user -for the password, pass the \fI\%\-\-username\fP option without -\fI\%\-\-password\fP or specify an empty string as the \fI\%\-\-password\fP value, -as in \fB\-\-password ""\fP . - -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-password\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationDatabase <dbname> -Specifies the authentication database where the specified \fI\%\-\-username\fP has been created. -See user\-authentication\-database\&. -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationDatabase\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.sp -Changed in version 3.0.0: \fI\%\-\-authenticationDatabase\fP is required for \fBmongod\fP -and \fBmongos\fP instances that use authentication\&. - -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-authenticationMechanism <name> -\fIDefault\fP: SCRAM\-SHA\-1 -.sp -Specifies the authentication mechanism the \fBmongotop\fP instance uses to -authenticate to the \fBmongod\fP or \fBmongos\fP\&. -.sp -Changed in version 4.0: MongoDB removes support for the deprecated MongoDB -Challenge\-Response (\fBMONGODB\-CR\fP) authentication mechanism. -.sp -MongoDB adds support for SCRAM mechanism using the SHA\-256 hash -function (\fBSCRAM\-SHA\-256\fP). - -.TS -center; -|l|l|. -_ -T{ -Value -T} T{ -Description -T} -_ -T{ -SCRAM\-SHA\-1 -T} T{ -\fI\%RFC 5802\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-1 -hash function. -T} -_ -T{ -SCRAM\-SHA\-256 -T} T{ -\fI\%RFC 7677\fP standard -Salted Challenge Response Authentication Mechanism using the SHA\-256 -hash function. -.sp -Requires featureCompatibilityVersion set to \fB4.0\fP\&. -.sp -New in version 4.0. -T} -_ -T{ -MONGODB\-X509 -T} T{ -MongoDB TLS/SSL certificate authentication. -T} -_ -T{ -GSSAPI (Kerberos) -T} T{ -External authentication using Kerberos. This mechanism is -available only in \fI\%MongoDB Enterprise\fP\&. -T} -_ -T{ -PLAIN (LDAP SASL) -T} T{ -External authentication using LDAP. You can also use \fBPLAIN\fP -for authenticating in\-database users. \fBPLAIN\fP transmits -passwords in plain text. This mechanism is available only in -\fI\%MongoDB Enterprise\fP\&. -T} -_ -.TE -.sp -\fBNOTE:\fP -.INDENT 7.0 -.INDENT 3.5 -You cannot specify both \fI\%\-\-authenticationMechanism\fP and \fI\%\-\-uri\fP\&. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiServiceName -New in version 2.6. - -.sp -Specify the name of the service using GSSAPI/Kerberos\&. Only required if the service does not use the -default name of \fBmongodb\fP\&. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-gssapiHostName -New in version 2.6. - -.sp -Specify the hostname of a service using GSSAPI/Kerberos\&. \fIOnly\fP required if the hostname of a machine does -not match the hostname resolved by DNS. -.sp -This option is available only in MongoDB Enterprise. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-locks -Toggles the mode of \fI\%mongotop\fP to report on use of per\-database -locks\&. This data is only available when connected to a -MongoDB 2.6 or older instance. -.sp -\fI\%\-\-locks\fP returns an error when called against a \fBmongod\fP 3.0 or -newer instance that does not report per\-database lock usage. -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-rowcount int, \-n int -Number of lines of data that \fBmongotop\fP should print. "0 for indefinite" -.UNINDENT -.INDENT 0.0 -.TP -.B \-\-json -New in version 3.0.0. - -.sp -Returns output for \fBmongotop\fP in JSON format. -.UNINDENT -.INDENT 0.0 -.TP -.B <sleeptime> -The final argument is the length of time, in seconds, that -\fBmongotop\fP waits in between calls. By default \fBmongotop\fP returns -data every second. -.UNINDENT -.SH FIELDS -.sp -When connected to a \fBmongod\fP instance, the program reports -first on the connection and then reports on the statistics at the -configured frequency. \fI\%mongotop\fP returns time values -specified in milliseconds (ms.) -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-04\-29T15:35:27.785\-0400 connected to: 127.0.0.1 - - ns total read write <timestamp> -<db.collection> 81802ms 0ms 81802ms -\&... - - ns total read write <timestamp> -<db.collection> 0ms 0ms 0ms -\&... -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -\fI\%mongotop\fP only reports active namespaces or databases, -depending on the \fI\%\-\-locks\fP option. If you don\(aqt see a database -or collection, it has received no recent activity. You can issue a -simple operation in the \fBmongo\fP shell to generate activity to -affect the output of \fI\%mongotop\fP\&. -.INDENT 0.0 -.TP -.B mongotop.ns -Contains the database namespace, which combines the database name -and collection. -.sp -If you use the \fI\%mongotop \-\-locks\fP, the \fI\%ns\fP -field does not appear in the \fI\%mongotop\fP output. -.UNINDENT -.INDENT 0.0 -.TP -.B mongotop.db -Contains the name of the database. The database named \fB\&.\fP refers -to the global lock, rather than a specific database. -.sp -This field does not appear unless you have invoked -\fI\%mongotop\fP with the \fI\%\-\-locks\fP option. -.UNINDENT -.INDENT 0.0 -.TP -.B mongotop.total -Provides the total amount of time that this \fBmongod\fP spent -operating on this namespace. -.UNINDENT -.INDENT 0.0 -.TP -.B mongotop.read -Provides the amount of time that this \fBmongod\fP spent -performing read operations on this namespace. -.UNINDENT -.INDENT 0.0 -.TP -.B mongotop.write -Provides the amount of time that this \fBmongod\fP spent -performing write operations on this namespace. -.UNINDENT -.INDENT 0.0 -.TP -.B mongotop.<timestamp> -Provides a time stamp for the returned data. -.UNINDENT -.SH EXAMPLES -.sp -By default \fI\%mongotop\fP connects to the MongoDB instance -running on the localhost port \fB27017\fP\&. However, \fI\%mongotop\fP can optionally -connect to remote \fBmongod\fP -instances. See the \fI\%mongotop options\fP for more -information. -.sp -To force \fI\%mongotop\fP to return less frequently specify a number, in -seconds at the end of the command. In this example, \fI\%mongotop\fP will -return every 15 seconds. -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 15 -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -This command produces the following output: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -2019\-04\-29T15:35:27.785\-0400 connected to: 127.0.0.1 - - - ns total read write 2019\-04\-29T15:35:57\-04:00 - admin.system.roles 0ms 0ms 0ms - admin.system.users 0ms 0ms 0ms - admin.system.version 0ms 0ms 0ms -config.system.sessions 0ms 0ms 0ms - local.startup_log 0ms 0ms 0ms - local.system.replset 0ms 0ms 0ms -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -To return a \fI\%mongotop\fP report every 5 minutes, use the -following command: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -mongotop 300 -.ft P -.fi -.UNINDENT -.UNINDENT -.SH ADDITIONAL INFORMATION -.sp -For more information about monitoring MongoDB, see -/administration/monitoring\&. -.sp -For additional background on various other MongoDB status outputs see: -.INDENT 0.0 -.IP \(bu 2 -/reference/command/serverStatus -.IP \(bu 2 -/reference/command/replSetGetStatus -.IP \(bu 2 -/reference/command/dbStats -.IP \(bu 2 -/reference/command/collStats -.UNINDENT -.sp -For an additional utility that provides MongoDB metrics -see mongostat\&. -.SH AUTHOR -MongoDB Documentation Project -.SH COPYRIGHT -2008-2019 -.\" Generated by docutils manpage writer. -. |