Skip to content

DOCSP-1018 - Documenting --uri option for tools #3240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/includes/options-mongodump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ inherit:
file: options-shared.yaml
---
program: mongodump
name: uri
inherit:
name: uri
program: _shared
file: options-shared.yaml
replacement:
program: ":binary:`~bin.mongodump`"
---
program: mongodump
name: host
inherit:
name: host
Expand Down
43 changes: 26 additions & 17 deletions source/includes/options-mongoexport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ inherit:
file: options-shared.yaml
---
program: mongoexport
name: uri
inherit:
name: uri
program: _shared
file: options-shared.yaml
replacement:
program: ":binary:`~bin.mongoexport`"
---
program: mongoexport
name: host
inherit:
name: host
Expand Down Expand Up @@ -190,7 +199,7 @@ description: |
specified field(s) is a field within a sub-document, the
:binary:`~bin.mongoexport` includes the sub-document with all
its fields, not just the specified field within the document.

See: :ref:`mongoexport-fields-example` for sample usage.
optional: true
---
Expand All @@ -209,7 +218,7 @@ description: |

:binary:`~bin.mongoexport` includes only the specified field(s). The
specified field(s) can be a field within a sub-document.

See :ref:`mongoexport-fieldFile-example` for sample usage.
optional: true
---
Expand Down Expand Up @@ -302,13 +311,13 @@ args: null
description: |
.. deprecated:: 3.2

Sets the :ref:`replica-set-read-preference` to :readmode:`nearest`,
allowing :binary:`~bin.mongoexport` to read data from secondary
Sets the :ref:`replica-set-read-preference` to :readmode:`nearest`,
allowing :binary:`~bin.mongoexport` to read data from secondary
:term:`replica set` members.
:option:`--readPreference` replaces ``--slaveOk`` in MongoDB 3.2. You cannot

:option:`--readPreference` replaces ``--slaveOk`` in MongoDB 3.2. You cannot
specify ``--slaveOk`` when :option:`--readPreference` is specified.

.. include:: /includes/warning-read-preference-mongos.rst
optional: true
---
Expand Down Expand Up @@ -390,17 +399,17 @@ optional: true
name: readPreference
args: <string>
description: |
Specify the :ref:`read preference<replica-set-read-preference>` for
{{program}}.
Specify the :ref:`read preference<replica-set-read-preference>` for
{{program}}.

See :ref:`replica-set-read-preference-modes`.
{{program}} defaults to :readmode:`primary`
:ref:`read preference <replica-set-read-preference>` when connected to a

{{program}} defaults to :readmode:`primary`
:ref:`read preference <replica-set-read-preference>` when connected to a
:binary:`~bin.mongos` or a :term:`replica set`.

Otherwise, {{program}} defaults to :readmode:`nearest`.

.. include:: /includes/warning-read-preference-mongos.rst
---
program: mongoexport
Expand All @@ -410,12 +419,12 @@ name: noHeaderLine
args: null
description: |
.. versionadded:: 3.4

By default, {{program}} includes the exported field names as the first
line in a CSV output. {{role}} directs {{program}} to export the
data without the list of field names.
{{role}} is **only valid** with the
:option:`--type <mongoexport --type>` option with value ``csv``.

See :ref:`mongoexport-noHeaderLine-example` for sample usage.
...
9 changes: 9 additions & 0 deletions source/includes/options-mongofiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ inherit:
file: options-shared.yaml
---
program: mongofiles
name: uri
inherit:
name: uri
program: _shared
file: options-shared.yaml
replacement:
program: ":binary:`~bin.mongofiles`"
---
program: mongofiles
name: host
directive: option
args: <hostname><:port>
Expand Down
77 changes: 43 additions & 34 deletions source/includes/options-mongoimport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ inherit:
file: options-shared.yaml
---
program: mongoimport
name: uri
inherit:
name: uri
program: _shared
file: options-shared.yaml
replacement:
program: ":binary:`~bin.mongoimport`"
---
program: mongoimport
name: host
inherit:
name: host
Expand Down Expand Up @@ -298,54 +307,54 @@ directive: option
args: insert|upsert|merge
description: |
.. versionadded:: 3.4

Specifies how the import process should handle existing documents
in the database that match documents in the import file.

By default, {{program}} uses the ``_id`` 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 ``upsert`` and ``merge`` modes,
documents for the ``upsert`` and ``merge`` modes,
use :option:`--upsertFields`.

.. list-table::
:header-rows: 1
:widths: 20 40

* - Value
- Description

* - ``insert``

- Insert the documents in the import file. {{program}} will log
an error if you attempt to import a document that contains a
duplicate value for a field with a :ref:`unique index
duplicate value for a field with a :ref:`unique index
<index-type-unique>`, such as ``_id``.

* - ``upsert``

- Replace existing documents in the database with matching
documents from the
import file. {{program}} will insert all other
documents. :ref:`ex-mongoimport-upsert` describes how to
use {{role}} ``upsert``.

* - ``merge``

- Merge existing documents that match a document in the import file with
the new document. {{program}} will insert all other documents.
the new document. {{program}} will insert all other documents.
:ref:`ex-mongoimport-merge` describes how to use {{role}}
``merge``.

default: insert
default: insert
optional: true
---
program: mongoimport
name: upsert
directive: option
args: null
description: |
.. deprecated:: 3.4 :option:`--mode` replaces {{role}}.
.. deprecated:: 3.4 :option:`--mode` replaces {{role}}.

Modifies the import process to update existing objects in the
database if they match an imported object, while inserting all
Expand Down Expand Up @@ -380,7 +389,7 @@ description: |
database if they match based on the specified fields, while
inserting all other objects. You do not need to use :option:`--mode
upsert <--mode>` with {{role}}.

If you do not specify a field, {{role}} will upsert on the basis of
the ``_id`` field.

Expand Down Expand Up @@ -449,73 +458,73 @@ description: |
Instructs {{program}} that the
field list specified in :option:`--fields`, :option:`--fieldFile`,
or :option:`--headerline` specifies the types of each field.

Field names must be in the form of ``<colName>.<type>(<arg>)``. You
must backslash-escape the following characters if you wish to include
them in an argument: ``(``, ``)``, and ``\``.

.. list-table::
:header-rows: 1
:widths: 20 33 47

* - ``type``
- Supported Arguments
- Example Header Field

* - ``auto()``
- None.
- ``misc.auto()``

* - ``binary(<arg>)``
- - ``base32`` (`RFC4648`_ encoding schema)
- - ``base32`` (`RFC4648`_ encoding schema)
- ``base64`` (`RFC4648`_ encoding schema)
- ``hex``
- ``user thumbnail.binary(base64)``

* - ``boolean()``
- None.
- ``verified.boolean()``

* - ``date(<arg>)``
- Alias for ``date_go(<arg>)``. `Go Language time.Parse format`_.
- ``created.date(2006-01-02 15:04:05)``

* - ``date_go(<arg>)``
- `Go Language time.Parse format`_
- ``created.date_go(2006-01-02 15:04:05)``

* - ``date_ms(<arg>)``
- `Microsoft SQL Server FORMAT format
- `Microsoft SQL Server FORMAT format
<https://msdn.microsoft.com/en-us/library/hh213505.aspx>`_
- ``created.date_ms(yyyy-MM-dd H:mm:ss)``

* - ``date_oracle(<arg>)``
- `Oracle Database TO_DATE format
- `Oracle Database TO_DATE format
<https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions183.htm>`_.
- ``created.date_oracle(YYYY-MM-DD HH24:MI:SS)``

* - ``decimal()``
- None
- ``price.decimal()``
- ``price.decimal()``

* - ``double()``
- None.
- ``revenue.double()``

* - ``int32()``
- None.
- ``followerCount.int32()``

* - ``int64()``
- None.
- ``bigNumber.int64()``

* - ``string()``
- None.
- ``zipcode.string()``

.. _Go Language time.Parse format: https://golang.org/src/time/format.go
.. _RFC4648: https://tools.ietf.org/html/rfc4648
.. _RFC4648: https://tools.ietf.org/html/rfc4648

See :ref:`example-csv-import-types` for sample usage.

Expand All @@ -529,10 +538,10 @@ pre: |

description: |
Specifies how {{program}} handles type coercion failures when importing
CSV or TSV files with :option:`--columnsHaveTypes`.
CSV or TSV files with :option:`--columnsHaveTypes`.

{{role}} has no effect when importing JSON documents.

.. list-table::
:widths: 20 80
:header-rows: 1
Expand Down
21 changes: 15 additions & 6 deletions source/includes/options-mongorestore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ inherit:
file: options-shared.yaml
---
program: mongorestore
name: uri
inherit:
name: uri
program: _shared
file: options-shared.yaml
replacement:
program: ":binary:`~bin.mongorestore`"
---
program: mongorestore
name: host
inherit:
name: host
Expand Down Expand Up @@ -229,7 +238,7 @@ description: |
directory. When used in conjunction with :option:`mongodump --oplog`,
:binary:`~bin.mongorestore --oplogReplay <mongorestore>`
restores the database to the point-in-time backup captured with the
``mongodump --oplog`` command.
``mongodump --oplog`` command.

For an example of {{role}}, see :ref:`backup-restore-oplogreplay`.

Expand All @@ -242,10 +251,10 @@ description: |

.. note::

When using :binary:`~bin.mongorestore` with {{role}}, you must
restore a full dump of a :term:`replica set` member created
using :binary:`~bin.mongodump --oplog <mongodump>`.
:binary:`~bin.mongorestore` with {{role}} fails if you use any of
When using :binary:`~bin.mongorestore` with {{role}}, you must
restore a full dump of a :term:`replica set` member created
using :binary:`~bin.mongodump --oplog <mongodump>`.
:binary:`~bin.mongorestore` with {{role}} fails if you use any of
the following options to limit the data be restored:

- :option:`--db`
Expand Down Expand Up @@ -512,6 +521,6 @@ pre: |
description: |
Runs {{program}} without actually importing any data, returning the
{{program}} summary information. Use with ``--verbose`` to produce
more detailed summary information.
more detailed summary information.
optional: true
...
Loading