From fedb44c16712e66e071dc7d7959d47b9e1ad2630 Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 15:52:09 -0400 Subject: [PATCH 1/7] Restructured --- snooty.toml | 3 +- source/includes/extracts-run-from-cmd.yaml | 7 - source/mongofiles.txt | 319 +++--------------- source/mongofiles/mongofiles-behavior.txt | 78 +++++ ...gofiles-compatibility-and-installation.txt | 61 ++++ source/mongofiles/mongofiles-examples.txt | 209 ++++++++++++ 6 files changed, 389 insertions(+), 288 deletions(-) create mode 100644 source/mongofiles/mongofiles-behavior.txt create mode 100644 source/mongofiles/mongofiles-compatibility-and-installation.txt create mode 100644 source/mongofiles/mongofiles-examples.txt diff --git a/snooty.toml b/snooty.toml index f28a1791..be39a6a2 100644 --- a/snooty.toml +++ b/snooty.toml @@ -9,7 +9,8 @@ toc_landing_pages = [ "/bsondump", "/mongodump", "/mongoimport", - "/mongorestore" + "/mongorestore", + "/mongofiles" ] [constants] diff --git a/source/includes/extracts-run-from-cmd.yaml b/source/includes/extracts-run-from-cmd.yaml index 486ec8cb..1047a8cc 100644 --- a/source/includes/extracts-run-from-cmd.yaml +++ b/source/includes/extracts-run-from-cmd.yaml @@ -36,11 +36,4 @@ inherit: ref: _require-cmd-line replacement: command: :binary:`~bin.mongotop` ---- -ref: require-cmd-line-mongofiles -inherit: - file: extracts-run-from-cmd.yaml - ref: _require-cmd-line -replacement: - command: :binary:`~bin.mongofiles` ... \ No newline at end of file diff --git a/source/mongofiles.txt b/source/mongofiles.txt index f5e35ad3..ed8e4ca7 100644 --- a/source/mongofiles.txt +++ b/source/mongofiles.txt @@ -17,74 +17,39 @@ :class: singlecol .. |arrow| unicode:: U+27A4 -.. |tool-binary| replace:: :binary:`~bin.mongofiles` +.. |tool-binary| replace:: ``mongofiles`` .. |mongodb-aws-example| replace:: :ref:`mongofiles-example-connect-using-aws-iam` Synopsis -------- -The :binary:`~bin.mongofiles` utility makes it possible to manipulate files +The ``mongofiles`` utility makes it possible to manipulate files stored in your MongoDB instance in :term:`GridFS` objects from the command line. It is particularly useful as it provides an interface between objects stored in your file system and GridFS. -.. include:: /includes/extracts/require-cmd-line-mongofiles.rst - -Versioning -~~~~~~~~~~ - -.. include:: /includes/extracts/dbtools-version-single.rst - -.. note:: Quick links to older documentation - - - :v4.2:`MongoDB 4.2 mongofiles ` - - :v4.0:`MongoDB 4.0 mongofiles ` - -This documentation is for version ``{+release+}`` of |tool-binary|. - -Compatibility -------------- - -MongoDB Server Compatibility -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. include:: /includes/extracts/dbtools-compatibility-single.rst - -Platform Support -~~~~~~~~~~~~~~~~ - -|tool-binary| version ``{+release+}`` is supported on the following -platforms: - -.. include:: /includes/fact-platform-support.rst - -Installation ------------- - -.. include:: /includes/fact-see-install-guide.rst Syntax ------ -The :binary:`~bin.mongofiles` command has the following form: +``mongofiles`` syntax: .. code-block:: sh mongofiles -.. include:: /includes/extracts/require-cmd-line-mongofiles.rst -The components of the :binary:`~bin.mongofiles` command are: +The components of the ``mongofiles`` command are: 1. :ref:`Options `. You may use one or more of - these options to control the behavior of :binary:`~bin.mongofiles`. + these options to control the behavior of ``mongofiles``. 2. :option:`Connection String `. The connection string of the :binary:`~bin.mongod` / :binary:`~bin.mongos` to connect to - with :binary:`~bin.mongofiles`. + with ``mongofiles``. 3. :ref:`Command `. Use one of these commands to - determine the action of :binary:`~bin.mongofiles`. + determine the action of ``mongofiles``. 4. An identifier which is either: the name of a file on your local file system, or a GridFS object. @@ -92,57 +57,9 @@ The components of the :binary:`~bin.mongofiles` command are: .. important:: For :term:`replica sets `, - :binary:`~bin.mongofiles` can only read from the set's + ``mongofiles`` can only read from the set's :term:`primary`. -Required Access ---------------- - -In order to connect to a :binary:`~bin.mongod` that enforces authorization -with the :option:`--auth ` option, you must use the -:option:`--username ` and :option:`--password -` options. The connecting user must possess, at a -minimum: - -- the :authrole:`read` role for the accessed database when using the - ``list``, ``search`` or ``get`` commands, - -- the :authrole:`readWrite` role for the accessed database when using - the ``put`` or ``delete`` commands. - -Behavior --------- - -FIPS -~~~~ - -:binary:`~bin.mongofiles` automatically creates FIPS-compliant -connections to a :binary:`~bin.mongod`/:binary:`~bin.mongos` that is -:manual:`configured to use FIPS mode `. - -Read Preference -~~~~~~~~~~~~~~~ - -By default, :binary:`~bin.mongofiles` uses read preference -:readmode:`primary`. To override the default, you can specify the -:ref:`read preference ` in the -:option:`--readPreference ` command line -option or in the :option:`--uri connection string `. - -If you specify read preference in the URI -string and the :option:`--readPreference `, -the :option:`--readPreference ` value -overrides the read preference specified in the URI string. - -Write Concern -~~~~~~~~~~~~~ - -You can specify both the -:option:`--writeConcern ` and the -:option:`--uri connection string ` option. If write -concern is specified using both options, the -:option:`--writeConcern ` value overrides -the write concern specified in the URI string. .. _mongofiles-options: @@ -151,7 +68,7 @@ Options .. option:: --help - Returns information on the options and use of :program:`mongofiles`. + Returns information on the options and use of ``mongofiles``. .. option:: --verbose, -v @@ -164,7 +81,7 @@ Options .. option:: --quiet - Runs :program:`mongofiles` in a quiet mode that attempts to limit the amount + Runs ``mongofiles`` in a quiet mode that attempts to limit the amount of output. This option suppresses: @@ -180,7 +97,7 @@ Options .. option:: --version - Returns the :program:`mongofiles` release number. + Returns the ``mongofiles`` release number. .. option:: --config= @@ -217,7 +134,7 @@ Options .. option:: --host=<:port> Specifies a resolvable hostname for the :binary:`~bin.mongod` that holds - your GridFS system. By default :binary:`~bin.mongofiles` attempts to connect + your GridFS system. By default ``mongofiles`` attempts to connect to a MongoDB process running on the localhost port number ``27017``. Optionally, specify a port number to connect a MongoDB instance running @@ -281,11 +198,11 @@ Options Specifies the password to de-crypt the certificate-key file (i.e. :option:`--sslPEMKeyFile`). Use the :option:`--sslPEMKeyPassword` option only if the - certificate-key file is encrypted. In all cases, the :program:`mongofiles` will + certificate-key file is encrypted. In all cases, the ``mongofiles`` will redact the password from all logging and reporting output. If the private key in the PEM file is encrypted and you do not specify - the :option:`--sslPEMKeyPassword` option, the :program:`mongofiles` will prompt for a passphrase. See + the :option:`--sslPEMKeyPassword` option, the ``mongofiles`` will prompt for a passphrase. See :ref:`ssl-certificate-password`. .. include:: /includes/extracts/uri-used-with-sslpemkeypassword.rst @@ -323,7 +240,7 @@ Options .. option:: --sslAllowInvalidHostnames Disables the validation of the hostnames in TLS/SSL certificates. Allows - :program:`mongofiles` to connect to MongoDB instances even if the hostname in their + ``mongofiles`` to connect to MongoDB instances even if the hostname in their certificates do not match the specified hostname. .. include:: /includes/extracts/uri-used-with-sslallowinvalidhostnames.rst @@ -378,12 +295,12 @@ Options *Default*: SCRAM-SHA-1 - Specifies the authentication mechanism the :program:`mongofiles` instance uses to + Specifies the authentication mechanism the ``mongofiles`` instance uses to authenticate to the :binary:`~bin.mongod` or :binary:`~bin.mongos`. .. versionchanged:: 100.1.0 - Starting in version ``100.1.0``, :program:`mongofiles` adds support + Starting in version ``100.1.0``, ``mongofiles`` adds support for the ``MONGODB-AWS`` authentication mechanism when connecting to a :atlas:`MongoDB Atlas ` cluster. @@ -414,7 +331,7 @@ Options .. option:: --db=, -d= - Specifies the name of the database on which to run the :program:`mongofiles`. + Specifies the name of the database on which to run the ``mongofiles``. .. include:: /includes/extracts/uri-used-with-db.rst @@ -426,7 +343,7 @@ Options In the :command:`mongofiles put` and :command:`mongofiles get` commands, the required ```` modifier refers to the name the object will - have in GridFS. :binary:`~bin.mongofiles` assumes that this reflects the + have in GridFS. ``mongofiles`` assumes that this reflects the file's name on the local file system. This setting overrides this default. @@ -435,7 +352,7 @@ Options .. option:: --type= Provides the ability to specify a :term:`MIME` type to describe the file - inserted into GridFS storage. :binary:`~bin.mongofiles` omits this option in + inserted into GridFS storage. ``mongofiles`` omits this option in the default operation. Use only with :command:`mongofiles put` operations. @@ -465,7 +382,7 @@ Options *Default*: majority - Specifies the :term:`write concern` for each write operation that :program:`mongofiles` + Specifies the :term:`write concern` for each write operation that ``mongofiles`` performs. Specify the write concern as a document with :ref:`w options `: @@ -486,7 +403,7 @@ Options *Default*: :readmode:`primary` Specifies the :ref:`read preference` for - :program:`mongofiles`. The :option:`--readPreference` option can take: + ``mongofiles``. The :option:`--readPreference` option can take: - A string if specifying only the read preference mode: @@ -506,7 +423,7 @@ Options If specifying the :ref:`maxStalenessSeconds `, the value must be greater than or equal to 90. - :program:`mongofiles` defaults to :readmode:`primary` + ``mongofiles`` defaults to :readmode:`primary` :ref:`read preference `. If the read preference is also included in the @@ -514,6 +431,7 @@ Options :option:`--readPreference` overrides the read preference specified in the URI string. + .. _mongofiles-commands: Commands @@ -537,7 +455,7 @@ Commands list. Each specified filename refers to the name the object will have in - GridFS, and :binary:`~bin.mongofiles` assumes that this reflects the + GridFS, and ``mongofiles`` assumes that this reflects the name the file has on the local file system. If the local filename is different, use the :option:`mongofiles --local` option. @@ -547,7 +465,7 @@ Commands file system. Each specified filename refers to the name the object has in - GridFS, and :binary:`~bin.mongofiles` will use this filename when + GridFS, and ``mongofiles`` will use this filename when writing to the local file system. If specifying *only one* ``filename`` to the ``get`` command, you can @@ -568,7 +486,7 @@ Commands the object in GridFS. ``get_id`` can accept either ObjectId values or non-ObjectId values for ``<_id>``. - :binary:`~bin.mongofiles` writes the file to the local + ``mongofiles`` writes the file to the local file system using the file's filename in GridFS. To choose a different location for the file on the local file system, use the :option:`--local ` option. @@ -587,7 +505,7 @@ Commands case-insensitivity. Multiple options should be provided together without separators, e.g. ``--regexOptions si`` - :binary:`~bin.mongofiles` writes the file or files to the local + ``mongofiles`` writes the file or files to the local file system using each file's matched filename in GridFS. You **cannot** use the :option:`--local ` option with the ``get_regex`` command. @@ -602,177 +520,18 @@ Commands ``delete_id`` can accept either ObjectId values or non-ObjectId values for ``<_id>``. -Examples --------- - -.. include:: /includes/extracts/require-cmd-line-mongofiles.rst - -To return a list of all files in a :term:`GridFS` collection in the -``records`` database, use the following invocation at the system shell: - -.. code-block:: sh - - mongofiles -d=records list - -This :binary:`~bin.mongofiles` instance will connect to the -:binary:`~bin.mongod` instance running on the ``27017`` localhost -interface to specify the same operation on a different port or -hostname, and issue a command that resembles one of the following: - -.. code-block:: sh - - mongofiles --port=37017 -d=records list - mongofiles --host=db1.example.net -d=records list - mongofiles --host=db1.example.net --port=37017 -d=records list - -Modify any of the following commands as needed if you're connecting -the :binary:`~bin.mongod` instances on different ports or hosts. - -To upload a file named ``32-corinth.lp`` to the GridFS collection in -the ``records`` database, you can use the following command: - -.. code-block:: sh - - mongofiles -d=records put 32-corinth.lp - -To delete the ``32-corinth.lp`` file from this GridFS collection in -the ``records`` database, you can use the following command: - -.. code-block:: sh - - mongofiles -d=records delete 32-corinth.lp - -To search for files in the GridFS collection in the ``records`` -database that have the string ``corinth`` in their names, you can use -following command: - -.. code-block:: sh - - mongofiles -d=records search corinth - -To list all files in the GridFS collection in the ``records`` database -with names that begin with the string ``32``, you can use the following -command: - -.. code-block:: sh - - mongofiles -d=records list 32 - -To fetch the file from the GridFS collection in the ``records`` -database named ``32-corinth.lp``, you can use the following command: - -.. code-block:: sh - - mongofiles -d=records get 32-corinth.lp - -To fetch all files from the GridFS collection in the ``records`` -database with names beginning with the string ``32`` and ending with the -string ``.lp``, you can use the following command: - -.. code-block:: sh - - mongofiles -d=records get_regex 32*.lp - -To fetch the file from the GridFS collection in the ``records`` database -with ``_id: ObjectId("56feac751f417d0357e7140f")``, you can use the -following command: - -.. code-block:: sh - - mongofiles -d=records get_id '{"$oid": "56feac751f417d0357e7140f"}' - -You must include quotation marks around the ``_id``. - -.. _mongofiles-example-connect-using-aws-iam: - -Connect to a MongoDB Atlas Cluster using AWS IAM Credentials -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 100.1.0 - -To connect to a :atlas:`MongoDB Atlas ` cluster which -has been configured to support authentication via `AWS IAM credentials -`__, -provide a :option:`connection string ` to -|tool-binary| similar to the following: - -.. code-block:: none - - mongofiles 'mongodb+srv://:@cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' - -Connecting to Atlas using AWS IAM credentials in this manner uses the -``MONGODB-AWS`` :urioption:`authentication mechanism ` -and the ``$external`` :urioption:`authSource`, as shown in this example. - -If using an `AWS session token -`__, -as well, provide it with the ``AWS_SESSION_TOKEN`` -:urioption:`authMechanismProperties` value, as follows: - -.. code-block:: none - - mongofiles 'mongodb+srv://:@cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:' - -.. include:: /includes/fact-pct-encode-uri.rst - -Alternatively, the AWS access key ID, secret access key, and optionally -session token can each be provided outside of the connection string -using the :option:`--username `, :option:`--password `, and -:option:`--awsSessionToken` options instead, like so: - -.. code-block:: none - - mongofiles 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' --username --password --awsSessionToken - -When provided as command line parameters, these three options do not -require percent encoding. - -You may also set these credentials on your platform using standard -`AWS IAM environment variables -`__. -|tool-binary| checks for the following environment variables when you -use the ``MONGODB-AWS`` -:urioption:`authentication mechanism `: - -- ``AWS_ACCESS_KEY_ID`` -- ``AWS_SECRET_ACCESS_KEY`` -- ``AWS_SESSION_TOKEN`` - -If set, these credentials do not need to be specified in the connection -string or via their explicit options. - -.. note:: - - If you chose to use the AWS environment variables to specify these - values, you cannot mix and match with the corresponding explicit or - connection string options for these credentials. Either use the - environment variables for access key ID *and* secret access key - (*and* session token if used), **or** specify each of these using the - explicit or connection string options instead. - -The following example sets these environment variables in the ``bash`` -shell: - -.. code-block:: none - - export AWS_ACCESS_KEY_ID='' - export AWS_SECRET_ACCESS_KEY='' - export AWS_SESSION_TOKEN='' - -Syntax for setting environment variables in other shells will be -different. Consult the documentation for your platform for more -information. - -You can verify that these environment variables have been set with the -following command: - -.. code-block:: none - env | grep AWS +Learn More +---------- -Once set, the following example connects to a MongoDB Atlas cluster -using these environment variables: +- :ref:`mongofiles-compatibility-and-installation` +- :ref:`mongofiles Behavior ` +- :ref:`mongofiles-examples` -.. code-block:: none +.. toctree:: + :maxdepth: 1 + :hidden: - mongofiles 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' + Compatibility and Installation + Behavior + Examples \ No newline at end of file diff --git a/source/mongofiles/mongofiles-behavior.txt b/source/mongofiles/mongofiles-behavior.txt new file mode 100644 index 00000000..3f749550 --- /dev/null +++ b/source/mongofiles/mongofiles-behavior.txt @@ -0,0 +1,78 @@ +.. _mongofiles-behavior-access-usage: + +============================================ +mongofiles Behavior, Access, and Usage +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. facet:: + :name: genre + :values: reference + +.. |arrow| unicode:: U+27A4 +.. |tool-binary| replace:: ``mongofiles`` + +Behavior +-------- + +FIPS +~~~~ + +``mongofiles`` automatically creates FIPS-compliant +connections to a :binary:`~bin.mongod`/:binary:`~bin.mongos` that is +:manual:`configured to use FIPS mode `. + +Read Preference +~~~~~~~~~~~~~~~ + +By default, ``mongofiles`` uses read preference +:readmode:`primary`. To override the default, you can specify the +:ref:`read preference ` in the +:option:`--readPreference ` command line +option or in the :option:`--uri connection string `. + +If you specify read preference in the URI +string and the :option:`--readPreference `, +the :option:`--readPreference ` value +overrides the read preference specified in the URI string. + +Write Concern +~~~~~~~~~~~~~ + +You can specify both the +:option:`--writeConcern ` and the +:option:`--uri connection string ` option. If write +concern is specified using both options, the +:option:`--writeConcern ` value overrides +the write concern specified in the URI string. + + +Required Access +--------------- + +In order to connect to a :binary:`~bin.mongod` that enforces authorization +with the :option:`--auth ` option, you must use the +:option:`--username ` and :option:`--password +` options. The connecting user must possess, at a +minimum: + +- the :authrole:`read` role for the accessed database when using the + ``list``, ``search`` or ``get`` commands, + +- the :authrole:`readWrite` role for the accessed database when using + the ``put`` or ``delete`` commands. + + +Learn More +---------- + +- :ref:`mongofiles` +- :ref:`mongofiles-compatibility-and-installation` +- :ref:`mongofiles-examples` \ No newline at end of file diff --git a/source/mongofiles/mongofiles-compatibility-and-installation.txt b/source/mongofiles/mongofiles-compatibility-and-installation.txt new file mode 100644 index 00000000..470fe2ac --- /dev/null +++ b/source/mongofiles/mongofiles-compatibility-and-installation.txt @@ -0,0 +1,61 @@ +.. _mongofiles-compatibility-and-installation: + +================================================ +mongofiles Compatibility and Installation +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. facet:: + :name: genre + :values: reference + +.. facet:: + :name: programming_language + :values: shell + +.. |arrow| unicode:: U+27A4 +.. |tool-binary| replace:: ``mongofiles`` +.. |app-name| replace:: ``mongofiles`` + +This page describes software compatibility and installation for version +``{+release+}`` of |tool-binary|. + +Starting in MongoDB 4.4, the {+dbtools+} are released separately from +the MongoDB Server. The {+dbtools+} use their own versioning, with an +initial version of ``100.0.0``. + +Compatibility +------------- + +MongoDB Server Compatibility +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/extracts/dbtools-compatibility-single.rst + +Platform Support +~~~~~~~~~~~~~~~~ + +|tool-binary| version ``{+release+}`` is supported on the following +platforms: + +.. include:: /includes/fact-platform-support.rst + +Installation +------------ + +.. include:: /includes/fact-see-install-guide.rst + + +Learn More +---------- + +- :ref:`mongofiles` +- :ref:`mongofiles Behavior ` +- :ref:`mongofiles-examples` \ No newline at end of file diff --git a/source/mongofiles/mongofiles-examples.txt b/source/mongofiles/mongofiles-examples.txt new file mode 100644 index 00000000..6b6012a4 --- /dev/null +++ b/source/mongofiles/mongofiles-examples.txt @@ -0,0 +1,209 @@ +.. _mongofiles-examples: + +===================== +mongofiles Examples +===================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. facet:: + :name: genre + :values: reference + +.. facet:: + :name: programming_language + :values: shell + +.. |arrow| unicode:: U+27A4 +.. |tool-binary| replace:: ``mongofiles`` + +This page shows examples for |tool-binary|. + +Run |tool-binary| from the system command line, not the +:binary:`~bin.mongo` shell. + +Return all Files in a GridFS Collection +------------------------------------------------------------------------------- + +To return a list of all files in a :term:`GridFS` collection in the +``records`` database, use the following invocation at the system shell: + +.. code-block:: sh + + mongofiles -d=records list + +This ``mongofiles`` instance will connect to the +:binary:`~bin.mongod` instance running on the ``27017`` localhost +interface to specify the same operation on a different port or +hostname, and issue a command that resembles one of the following: + +.. code-block:: sh + + mongofiles --port=37017 -d=records list + mongofiles --host=db1.example.net -d=records list + mongofiles --host=db1.example.net --port=37017 -d=records list + +Modify any of the following commands as needed if you're connecting +the :binary:`~bin.mongod` instances on different ports or hosts. + +To upload a file named ``32-corinth.lp`` to the GridFS collection in +the ``records`` database, you can use the following command: + +.. code-block:: sh + + mongofiles -d=records put 32-corinth.lp + +To delete the ``32-corinth.lp`` file from this GridFS collection in +the ``records`` database, you can use the following command: + +.. code-block:: sh + + mongofiles -d=records delete 32-corinth.lp + +To search for files in the GridFS collection in the ``records`` +database that have the string ``corinth`` in their names, you can use +following command: + +.. code-block:: sh + + mongofiles -d=records search corinth + +To list all files in the GridFS collection in the ``records`` database +with names that begin with the string ``32``, you can use the following +command: + +.. code-block:: sh + + mongofiles -d=records list 32 + +To fetch the file from the GridFS collection in the ``records`` +database named ``32-corinth.lp``, you can use the following command: + +.. code-block:: sh + + mongofiles -d=records get 32-corinth.lp + +To fetch all files from the GridFS collection in the ``records`` +database with names beginning with the string ``32`` and ending with the +string ``.lp``, you can use the following command: + +.. code-block:: sh + + mongofiles -d=records get_regex 32*.lp + +To fetch the file from the GridFS collection in the ``records`` database +with ``_id: ObjectId("56feac751f417d0357e7140f")``, you can use the +following command: + +.. code-block:: sh + + mongofiles -d=records get_id '{"$oid": "56feac751f417d0357e7140f"}' + +You must include quotation marks around the ``_id``. + +.. _mongofiles-example-connect-using-aws-iam: + +Connect to a MongoDB Atlas Cluster using AWS IAM Credentials +------------------------------------------------------------------------------- + +.. versionadded:: 100.1.0 + +To connect to a :atlas:`MongoDB Atlas ` cluster which +has been configured to support authentication via `AWS IAM credentials +`__, +provide a :option:`connection string ` to +|tool-binary| similar to the following: + +.. code-block:: none + + mongofiles 'mongodb+srv://:@cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' + +Connecting to Atlas using AWS IAM credentials in this manner uses the +``MONGODB-AWS`` :urioption:`authentication mechanism ` +and the ``$external`` :urioption:`authSource`, as shown in this example. + +If using an `AWS session token +`__, +as well, provide it with the ``AWS_SESSION_TOKEN`` +:urioption:`authMechanismProperties` value, as follows: + +.. code-block:: none + + mongofiles 'mongodb+srv://:@cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:' + +.. include:: /includes/fact-pct-encode-uri.rst + +Alternatively, the AWS access key ID, secret access key, and optionally +session token can each be provided outside of the connection string +using the :option:`--username `, :option:`--password `, and +:option:`--awsSessionToken ` options instead, like so: + +.. code-block:: none + + mongofiles 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' --username --password --awsSessionToken + +When provided as command line parameters, these three options do not +require percent encoding. + +You may also set these credentials on your platform using standard +`AWS IAM environment variables +`__. +|tool-binary| checks for the following environment variables when you +use the ``MONGODB-AWS`` +:urioption:`authentication mechanism `: + +- ``AWS_ACCESS_KEY_ID`` +- ``AWS_SECRET_ACCESS_KEY`` +- ``AWS_SESSION_TOKEN`` + +If set, these credentials do not need to be specified in the connection +string or via their explicit options. + +.. note:: + + If you chose to use the AWS environment variables to specify these + values, you cannot mix and match with the corresponding explicit or + connection string options for these credentials. Either use the + environment variables for access key ID *and* secret access key + (*and* session token if used), **or** specify each of these using the + explicit or connection string options instead. + +The following example sets these environment variables in the ``bash`` +shell: + +.. code-block:: none + + export AWS_ACCESS_KEY_ID='' + export AWS_SECRET_ACCESS_KEY='' + export AWS_SESSION_TOKEN='' + +Syntax for setting environment variables in other shells will be +different. Consult the documentation for your platform for more +information. + +You can verify that these environment variables have been set with the +following command: + +.. code-block:: none + + env | grep AWS + +Once set, the following example connects to a MongoDB Atlas cluster +using these environment variables: + +.. code-block:: none + + mongofiles 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' + +Learn More +---------- + +- :ref:`mongofiles` +- :ref:`mongofiles-compatibility-and-installation` +- :ref:`mongofiles Behavior ` \ No newline at end of file From 26fb718a5d766ee4d4e5a10ab45112fa07e940cb Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:10:25 -0400 Subject: [PATCH 2/7] Cleaned up meta info --- source/includes/extracts-run-from-cmd.yaml | 14 ------------- source/mongofiles.txt | 23 ++++++++++++++-------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/source/includes/extracts-run-from-cmd.yaml b/source/includes/extracts-run-from-cmd.yaml index b1e295cf..27d115ab 100644 --- a/source/includes/extracts-run-from-cmd.yaml +++ b/source/includes/extracts-run-from-cmd.yaml @@ -15,18 +15,4 @@ inherit: ref: _require-cmd-line replacement: command: :binary:`~bin.bsondump` ---- -ref: require-cmd-line-mongoexport -inherit: - file: extracts-run-from-cmd.yaml - ref: _require-cmd-line -replacement: - command: :binary:`~bin.mongoexport` ---- -ref: require-cmd-line-mongotop -inherit: - file: extracts-run-from-cmd.yaml - ref: _require-cmd-line -replacement: - command: :binary:`~bin.mongotop` ... \ No newline at end of file diff --git a/source/mongofiles.txt b/source/mongofiles.txt index ed8e4ca7..c04e599c 100644 --- a/source/mongofiles.txt +++ b/source/mongofiles.txt @@ -1,29 +1,36 @@ +.. _mongofiles: + +=============== +``mongofiles`` +=============== + .. default-domain:: mongodb .. binary:: mongofiles .. program:: mongofiles -.. _mongofiles: - -============== -``mongofiles`` -============== - .. contents:: On this page :local: :backlinks: none :depth: 1 :class: singlecol +.. facet:: + :name: genre + :values: reference + .. |arrow| unicode:: U+27A4 .. |tool-binary| replace:: ``mongofiles`` -.. |mongodb-aws-example| replace:: :ref:`mongofiles-example-connect-using-aws-iam` + +.. |mongodb-aws-example| replace:: :ref:`mongofiles-example-connect-using-aws-iam` + +This documentation is for version ``{+release+}`` of |tool-binary|. Synopsis -------- -The ``mongofiles`` utility makes it possible to manipulate files +``mongofiles`` makes it possible to manipulate files stored in your MongoDB instance in :term:`GridFS` objects from the command line. It is particularly useful as it provides an interface between objects stored in your file system and GridFS. From f876fb9e75464b8ba5ba4f477a5cdf522a012d72 Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:13:33 -0400 Subject: [PATCH 3/7] Shortened mongodump behavior links too --- source/mongodump.txt | 2 +- source/mongodump/mongodump-compatibility-and-installation.txt | 2 +- source/mongodump/mongodump-examples.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/mongodump.txt b/source/mongodump.txt index 2c04d097..770d9dfb 100644 --- a/source/mongodump.txt +++ b/source/mongodump.txt @@ -723,7 +723,7 @@ Learn More For more information about ``mongodump``, see: - :ref:`mongodump-compatibility-and-installation` -- :ref:`mongodump-behavior` +- :ref:`mongodump Behavior ` - :ref:`mongodump-examples` .. include:: /includes/extracts/ssl-facts-see-more.rst diff --git a/source/mongodump/mongodump-compatibility-and-installation.txt b/source/mongodump/mongodump-compatibility-and-installation.txt index 864766f4..94cfd1fa 100644 --- a/source/mongodump/mongodump-compatibility-and-installation.txt +++ b/source/mongodump/mongodump-compatibility-and-installation.txt @@ -61,5 +61,5 @@ Learn More ---------- - :ref:`mongodump` -- :ref:`mongodump-behavior` +- :ref:`mongodump Behavior ` - :ref:`mongodump-examples` diff --git a/source/mongodump/mongodump-examples.txt b/source/mongodump/mongodump-examples.txt index 287f680f..bf5d1b14 100644 --- a/source/mongodump/mongodump-examples.txt +++ b/source/mongodump/mongodump-examples.txt @@ -250,4 +250,4 @@ Learn More - :ref:`mongodump` - :ref:`mongodump-compatibility-and-installation` -- :ref:`mongodump-behavior` +- :ref:`mongodump Behavior ` From c79fa3e625bcccf77b9080c429b91b8eb7dc78a0 Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:14:47 -0400 Subject: [PATCH 4/7] Added monospace treatment to previously refactored files --- source/bsondump.txt | 6 +++--- source/mongodump.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/bsondump.txt b/source/bsondump.txt index 516a8e06..ecf5bce5 100644 --- a/source/bsondump.txt +++ b/source/bsondump.txt @@ -1,8 +1,8 @@ .. _bsondump: -======== -bsondump -======== +============ +``bsondump`` +============ .. default-domain:: mongodb diff --git a/source/mongodump.txt b/source/mongodump.txt index 770d9dfb..4f3c146a 100644 --- a/source/mongodump.txt +++ b/source/mongodump.txt @@ -1,8 +1,8 @@ .. _mongodump: -========= -mongodump -========= +============= +``mongodump`` +============= .. default-domain:: mongodb From e9c6e8040535b8f2b889b87b7c84c79effd9519c Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:16:20 -0400 Subject: [PATCH 5/7] Shortened behavior refs for ease of use --- source/mongoexport.txt | 2 +- source/mongoexport/mongoexport-behavior.txt | 2 +- .../mongoexport-compatibility-and-installation.txt | 2 +- source/mongoexport/mongoexport-examples.txt | 2 +- source/mongofiles.txt | 2 +- source/mongofiles/mongofiles-behavior.txt | 2 +- .../mongofiles/mongofiles-compatibility-and-installation.txt | 2 +- source/mongofiles/mongofiles-examples.txt | 2 +- source/mongoimport.txt | 2 +- source/mongoimport/mongoimport-behavior.txt | 2 +- .../mongoimport-compatibility-and-installation.txt | 2 +- source/mongoimport/mongoimport-examples.txt | 2 +- source/mongorestore.txt | 4 ++-- source/mongorestore/mongorestore-behavior-access-usage.txt | 2 +- .../mongorestore-compatibility-and-installation.txt | 2 +- source/mongorestore/mongorestore-examples.txt | 2 +- source/mongostat.txt | 2 +- source/mongostat/mongostat-behavior.txt | 2 +- source/mongostat/mongostat-compatibility-and-installation.txt | 2 +- source/mongostat/mongostat-examples.txt | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/mongoexport.txt b/source/mongoexport.txt index bd640938..d79944f4 100644 --- a/source/mongoexport.txt +++ b/source/mongoexport.txt @@ -753,7 +753,7 @@ Learn More ---------- - :ref:`mongoexport-compatibility-and-installation` -- :ref:`mongoexport Behavior ` +- :ref:`mongoexport Behavior ` - :ref:`mongoexport-examples` .. toctree:: diff --git a/source/mongoexport/mongoexport-behavior.txt b/source/mongoexport/mongoexport-behavior.txt index cae65cc6..d18de39b 100644 --- a/source/mongoexport/mongoexport-behavior.txt +++ b/source/mongoexport/mongoexport-behavior.txt @@ -1,4 +1,4 @@ -.. _mongoexport-behavior-access-usage: +.. _mongoexport-behavior: ============================================ mongoexport Behavior, Access, and Usage diff --git a/source/mongoexport/mongoexport-compatibility-and-installation.txt b/source/mongoexport/mongoexport-compatibility-and-installation.txt index 6888aef1..d1fb8359 100644 --- a/source/mongoexport/mongoexport-compatibility-and-installation.txt +++ b/source/mongoexport/mongoexport-compatibility-and-installation.txt @@ -57,5 +57,5 @@ Learn More ---------- - :ref:`mongoexport` -- :ref:`mongoexport Behavior ` +- :ref:`mongoexport Behavior ` - :ref:`mongoexport-examples` \ No newline at end of file diff --git a/source/mongoexport/mongoexport-examples.txt b/source/mongoexport/mongoexport-examples.txt index 722d7bc9..72eea872 100644 --- a/source/mongoexport/mongoexport-examples.txt +++ b/source/mongoexport/mongoexport-examples.txt @@ -278,4 +278,4 @@ Learn More - :ref:`mongoexport` - :ref:`mongoexport-compatibility-and-installation` -- :ref:`mongoexport Behavior ` \ No newline at end of file +- :ref:`mongoexport Behavior ` \ No newline at end of file diff --git a/source/mongofiles.txt b/source/mongofiles.txt index c04e599c..fa1284db 100644 --- a/source/mongofiles.txt +++ b/source/mongofiles.txt @@ -532,7 +532,7 @@ Learn More ---------- - :ref:`mongofiles-compatibility-and-installation` -- :ref:`mongofiles Behavior ` +- :ref:`mongofiles Behavior ` - :ref:`mongofiles-examples` .. toctree:: diff --git a/source/mongofiles/mongofiles-behavior.txt b/source/mongofiles/mongofiles-behavior.txt index 3f749550..48466285 100644 --- a/source/mongofiles/mongofiles-behavior.txt +++ b/source/mongofiles/mongofiles-behavior.txt @@ -1,4 +1,4 @@ -.. _mongofiles-behavior-access-usage: +.. _mongofiles-behavior: ============================================ mongofiles Behavior, Access, and Usage diff --git a/source/mongofiles/mongofiles-compatibility-and-installation.txt b/source/mongofiles/mongofiles-compatibility-and-installation.txt index 470fe2ac..fcfa4cf8 100644 --- a/source/mongofiles/mongofiles-compatibility-and-installation.txt +++ b/source/mongofiles/mongofiles-compatibility-and-installation.txt @@ -57,5 +57,5 @@ Learn More ---------- - :ref:`mongofiles` -- :ref:`mongofiles Behavior ` +- :ref:`mongofiles Behavior ` - :ref:`mongofiles-examples` \ No newline at end of file diff --git a/source/mongofiles/mongofiles-examples.txt b/source/mongofiles/mongofiles-examples.txt index 6b6012a4..4560ecfa 100644 --- a/source/mongofiles/mongofiles-examples.txt +++ b/source/mongofiles/mongofiles-examples.txt @@ -206,4 +206,4 @@ Learn More - :ref:`mongofiles` - :ref:`mongofiles-compatibility-and-installation` -- :ref:`mongofiles Behavior ` \ No newline at end of file +- :ref:`mongofiles Behavior ` \ No newline at end of file diff --git a/source/mongoimport.txt b/source/mongoimport.txt index 392e6a51..d4839946 100644 --- a/source/mongoimport.txt +++ b/source/mongoimport.txt @@ -789,7 +789,7 @@ Learn More ---------- - :ref:`mongoimport-compatibility-and-installation` -- :ref:`mongoimport Behavior ` +- :ref:`mongoimport Behavior ` - :ref:`mongoimport-examples` .. toctree:: diff --git a/source/mongoimport/mongoimport-behavior.txt b/source/mongoimport/mongoimport-behavior.txt index 1fad8bb6..47af7b32 100644 --- a/source/mongoimport/mongoimport-behavior.txt +++ b/source/mongoimport/mongoimport-behavior.txt @@ -1,4 +1,4 @@ -.. _mongoimport-behavior-access-usage: +.. _mongoimport-behavior: ============================================ mongoimport Behavior, Access, and Usage diff --git a/source/mongoimport/mongoimport-compatibility-and-installation.txt b/source/mongoimport/mongoimport-compatibility-and-installation.txt index c7888cc6..e5c8d8a0 100644 --- a/source/mongoimport/mongoimport-compatibility-and-installation.txt +++ b/source/mongoimport/mongoimport-compatibility-and-installation.txt @@ -59,5 +59,5 @@ Learn More ---------- - :ref:`mongoimport` -- :ref:`mongoimport Behavior ` +- :ref:`mongoimport Behavior ` - :ref:`mongoimport-examples` \ No newline at end of file diff --git a/source/mongoimport/mongoimport-examples.txt b/source/mongoimport/mongoimport-examples.txt index 4c7eb0b2..2e3cc7b1 100644 --- a/source/mongoimport/mongoimport-examples.txt +++ b/source/mongoimport/mongoimport-examples.txt @@ -423,4 +423,4 @@ Learn More - :ref:`mongoimport` - :ref:`mongoimport-compatibility-and-installation` -- :ref:`mongoimport Behavior ` \ No newline at end of file +- :ref:`mongoimport Behavior ` \ No newline at end of file diff --git a/source/mongorestore.txt b/source/mongorestore.txt index b3bf8417..23673338 100644 --- a/source/mongorestore.txt +++ b/source/mongorestore.txt @@ -852,7 +852,7 @@ Learn More ---------- - :ref:`mongorestore-compatibility-and-installation` -- :ref:`Behavior ` +- :ref:`Behavior ` - :ref:`mongorestore-examples` .. toctree:: @@ -860,5 +860,5 @@ Learn More :hidden: Compatibility and Installation - Behavior + Behavior Examples \ No newline at end of file diff --git a/source/mongorestore/mongorestore-behavior-access-usage.txt b/source/mongorestore/mongorestore-behavior-access-usage.txt index b5daeb9e..99319848 100644 --- a/source/mongorestore/mongorestore-behavior-access-usage.txt +++ b/source/mongorestore/mongorestore-behavior-access-usage.txt @@ -1,4 +1,4 @@ -.. _mongorestore-behavior-access-usage: +.. _mongorestore-behavior: ============================================ mongorestore Behavior, Access, and Usage diff --git a/source/mongorestore/mongorestore-compatibility-and-installation.txt b/source/mongorestore/mongorestore-compatibility-and-installation.txt index 06c0f885..e3e343f4 100644 --- a/source/mongorestore/mongorestore-compatibility-and-installation.txt +++ b/source/mongorestore/mongorestore-compatibility-and-installation.txt @@ -62,5 +62,5 @@ Learn More ---------- - :ref:`mongorestore` -- :ref:`Behavior ` +- :ref:`Behavior ` - :ref:`mongorestore-examples` \ No newline at end of file diff --git a/source/mongorestore/mongorestore-examples.txt b/source/mongorestore/mongorestore-examples.txt index 9969864d..f9dc2b1a 100644 --- a/source/mongorestore/mongorestore-examples.txt +++ b/source/mongorestore/mongorestore-examples.txt @@ -444,4 +444,4 @@ Learn More - :ref:`mongorestore` - :ref:`mongorestore-compatibility-and-installation` -- :ref:`Behavior ` \ No newline at end of file +- :ref:`Behavior ` \ No newline at end of file diff --git a/source/mongostat.txt b/source/mongostat.txt index 730c09d1..da2d1604 100644 --- a/source/mongostat.txt +++ b/source/mongostat.txt @@ -649,7 +649,7 @@ Learn More ---------- - :ref:`mongostat-compatibility-and-installation` -- :ref:`mongostat Behavior ` +- :ref:`mongostat Behavior ` - :ref:`mongostat-examples` .. toctree:: diff --git a/source/mongostat/mongostat-behavior.txt b/source/mongostat/mongostat-behavior.txt index 3110d33d..65e7bfcf 100644 --- a/source/mongostat/mongostat-behavior.txt +++ b/source/mongostat/mongostat-behavior.txt @@ -1,4 +1,4 @@ -.. _mongostat-behavior-access-usage: +.. _mongostat-behavior: ============================================ mongostat Behavior, Access, and Usage diff --git a/source/mongostat/mongostat-compatibility-and-installation.txt b/source/mongostat/mongostat-compatibility-and-installation.txt index 172107e3..1d569dac 100644 --- a/source/mongostat/mongostat-compatibility-and-installation.txt +++ b/source/mongostat/mongostat-compatibility-and-installation.txt @@ -57,5 +57,5 @@ Learn More ---------- - :ref:`mongostat` -- :ref:`mongostat Behavior ` +- :ref:`mongostat Behavior ` - :ref:`mongostat-examples` \ No newline at end of file diff --git a/source/mongostat/mongostat-examples.txt b/source/mongostat/mongostat-examples.txt index 9b269aa1..ebd71f74 100644 --- a/source/mongostat/mongostat-examples.txt +++ b/source/mongostat/mongostat-examples.txt @@ -356,4 +356,4 @@ Learn More - :ref:`mongostat` - :ref:`mongostat-compatibility-and-installation` -- :ref:`mongostat Behavior ` \ No newline at end of file +- :ref:`mongostat Behavior ` \ No newline at end of file From bb60b26f1e75596bb85015ed6911f6e5f2d1a1ce Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:17:34 -0400 Subject: [PATCH 6/7] Renamed mongorestore-behavior for brevity --- ...estore-behavior-access-usage.txt => mongorestore-behavior.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/mongorestore/{mongorestore-behavior-access-usage.txt => mongorestore-behavior.txt} (100%) diff --git a/source/mongorestore/mongorestore-behavior-access-usage.txt b/source/mongorestore/mongorestore-behavior.txt similarity index 100% rename from source/mongorestore/mongorestore-behavior-access-usage.txt rename to source/mongorestore/mongorestore-behavior.txt From 69d4d32d1be1c9fbdc72efb275967186b64487f7 Mon Sep 17 00:00:00 2001 From: Nick Villahermosa Date: Thu, 4 Apr 2024 16:19:22 -0400 Subject: [PATCH 7/7] Adding back extract to check build errors list --- source/includes/extracts-run-from-cmd.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/includes/extracts-run-from-cmd.yaml b/source/includes/extracts-run-from-cmd.yaml index 27d115ab..88b37bd1 100644 --- a/source/includes/extracts-run-from-cmd.yaml +++ b/source/includes/extracts-run-from-cmd.yaml @@ -9,6 +9,13 @@ inherit: replacement: command: :binary:`~bin.mongodump` --- +ref: require-cmd-line-mongotop +inherit: + file: extracts-run-from-cmd.yaml + ref: _require-cmd-line +replacement: + command: :binary:`~bin.mongotop` +--- ref: require-cmd-line-bsondump inherit: file: extracts-run-from-cmd.yaml