diff --git a/source/core/replica-set-hidden-member.txt b/source/core/replica-set-hidden-member.txt index 2563f872925..3e2b3af8653 100644 --- a/source/core/replica-set-hidden-member.txt +++ b/source/core/replica-set-hidden-member.txt @@ -19,7 +19,7 @@ data set but is **invisible** to client applications. Hidden members are good for workloads with different usage patterns from the other members in the :term:`replica set`. Hidden members must always be :ref:`priority 0 members ` and -so **cannot become primary**. The :method:`db.isMaster()` method does not +so **cannot become primary**. The :method:`db.hello()` method does not display hidden members. Hidden members, however, **may vote** in :ref:`elections `. diff --git a/source/core/sharded-cluster-query-router.txt b/source/core/sharded-cluster-query-router.txt index 0c10404eb30..50bafe4dc51 100644 --- a/source/core/sharded-cluster-query-router.txt +++ b/source/core/sharded-cluster-query-router.txt @@ -135,15 +135,15 @@ Confirm Connection to ``mongos`` Instances ------------------------------------------ To detect if the MongoDB instance that your client is connected -to is :binary:`~bin.mongos`, use the :dbcommand:`isMaster` command. When a -client connects to a :binary:`~bin.mongos`, :dbcommand:`isMaster` returns +to is :binary:`~bin.mongos`, use the :dbcommand:`hello` command. When a +client connects to a :binary:`~bin.mongos`, :dbcommand:`hello` returns a document with a ``msg`` field that holds the string ``isdbgrid``. For example: .. code-block:: javascript { - "ismaster" : true, + "isWritablePrimary" : true, "msg" : "isdbgrid", "maxBsonObjectSize" : 16777216, "ok" : 1, diff --git a/source/includes/extracts-transactions.yaml b/source/includes/extracts-transactions.yaml index 408c17d70fb..3b98c9d2055 100644 --- a/source/includes/extracts-transactions.yaml +++ b/source/includes/extracts-transactions.yaml @@ -99,7 +99,7 @@ content: | ref: transactions-operations-restrictions-info content: | - Informational commands, such as :dbcommand:`isMaster`, + Informational commands, such as :dbcommand:`hello`, :dbcommand:`buildInfo`, :dbcommand:`connectionStatus` (and their helper methods) are allowed in transactions; however, they cannot be the first operation in the transaction. diff --git a/source/includes/fact-bulkwrite-operation-batches.rst b/source/includes/fact-bulkwrite-operation-batches.rst index ba64f975ef5..f864875e095 100644 --- a/source/includes/fact-bulkwrite-operation-batches.rst +++ b/source/includes/fact-bulkwrite-operation-batches.rst @@ -1,7 +1,7 @@ The number of operations in each group cannot exceed the value of the :limit:`maxWriteBatchSize ` of the database. As of MongoDB 3.6, this value is ``100,000``. -This value is shown in the :data:`isMaster.maxWriteBatchSize` field. +This value is shown in the :data:`hello.maxWriteBatchSize` field. This limit prevents issues with oversized error messages. If a group exceeds this :limit:`limit`, diff --git a/source/reference/command.txt b/source/reference/command.txt index 76fa0c54599..9c4920add14 100644 --- a/source/reference/command.txt +++ b/source/reference/command.txt @@ -359,9 +359,13 @@ Replication Commands - Internal command that applies :term:`oplog` entries to the current data set. + * - :dbcommand:`hello` + + - Displays information about this member's role in the replica set, including whether it is the primary. + * - :dbcommand:`isMaster` - - Displays information about this member's role in the replica set, including whether it is the master. + - *Deprecated*. Use :dbcommand:`hello` instead. * - :dbcommand:`replSetAbortPrimaryCatchUp` diff --git a/source/reference/command/hello.txt b/source/reference/command/hello.txt new file mode 100644 index 00000000000..8d76f0d6350 --- /dev/null +++ b/source/reference/command/hello.txt @@ -0,0 +1,348 @@ +===== +hello +===== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Definition +---------- + +.. dbcommand:: hello + + .. versionadded:: 4.2.10 (and 4.0.21 and 3.6.21) + + :dbcommand:`hello` returns a document that describes the role of + the :binary:`~bin.mongod` instance. If the optional field + ``saslSupportedMechs`` is specified, the command also returns an + :data:`array of SASL mechanisms ` used + to create the specified user's credentials. + + If the instance is a member of a + replica set, then :dbcommand:`hello` returns a subset of the + replica set configuration and status including whether or not the + instance is the :term:`primary` of the replica set. + + When sent to a :binary:`~bin.mongod` instance that is not a member of a + replica set, :dbcommand:`hello` returns a subset of this + information. + + MongoDB :term:`drivers ` and :term:`clients ` use + :dbcommand:`hello` to determine the state of the replica set + members and to discover additional members of a :term:`replica + set`. + +Syntax +------ + +The command takes the following form: + +.. code-block:: javascript + + db.runCommand( { hello: 1 } ) + +The :dbcommand:`hello` command accepts optional fields +``saslSupportedMechs: `` to return an additional field +:data:`hello.saslSupportedMechs` in its result and ``comment `` to +add a log comment associated with the command. + +.. code-block:: javascript + + db.runCommand( { hello: 1, saslSupportedMechs: "", comment: } ) + +The :method:`db.hello()` method in the :binary:`~bin.mongo` shell +provides a wrapper around :dbcommand:`hello`. + +Behavior +-------- + +.. |operation| replace:: :dbcommand:`hello` + +Client Disconnection +~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/extracts/4.2-changes-disconnect.rst + +Output +------ + +All Instances +~~~~~~~~~~~~~ + +The following :dbcommand:`hello` fields are common across all +roles: + +.. data:: hello.isWritablePrimary + + A boolean value that reports when this node is writable. If + ``true``, then this instance is a :term:`primary` in a + :term:`replica set`, or a :binary:`~bin.mongos` instance, or a standalone + :binary:`~bin.mongod`. + + This field will be ``false`` if the instance is a + :term:`secondary` member of a replica set or if the member is an + :term:`arbiter` of a replica set. + +.. data:: hello.topologyVersion + + *For internal use by MongoDB.* + +.. data:: hello.maxBsonObjectSize + + The maximum permitted size of a :term:`BSON` object in bytes for + this :binary:`~bin.mongod` process. If not provided, clients should + assume a max size of "``16 * 1024 * 1024``". + +.. data:: hello.maxMessageSizeBytes + + The maximum permitted size of a :term:`BSON` wire protocol message. + The default value is ``48000000`` bytes. + +.. data:: hello.maxWriteBatchSize + + The maximum number of write operations permitted in a write batch. + If a batch exceeds this + :limit:`limit`, the client + driver divides the batch into smaller groups each with counts less + than or equal to the value of this field. + + The value of this limit is ``100,000`` writes. + + The limit raises from ``1,000`` to ``100,000`` writes. This limit + also applies to legacy ``OP_INSERT`` messages. + +.. data:: hello.localTime + + Returns the local server time in UTC. This value is an + :term:`ISO date `. + +.. data:: hello.logicalSessionTimeoutMinutes + + .. include:: /includes/fact-session-timeout.rst + + Only available when ``featureCompatibilityVersion`` is ``"3.6"`` or greater. + See :ref:`3.6-compatibility-enabled`. + +.. data:: hello.connectionId + + An identifier for the :binary:`~bin.mongod`/:binary:`~bin.mongos` + instance's outgoing connection to the client. + +.. data:: hello.minWireVersion + + The earliest version of the wire protocol that this + :binary:`~bin.mongod` or :binary:`~bin.mongos` instance is capable of using + to communicate with clients. + + Clients may use :data:`~hello.minWireVersion` to help negotiate + compatibility with MongoDB. + +.. data:: hello.maxWireVersion + + The latest version of the wire protocol that this :binary:`~bin.mongod` + or :binary:`~bin.mongos` instance is capable of using to communicate + with clients. + + Clients may use :data:`~hello.maxWireVersion` to help negotiate + compatibility with MongoDB. + +.. data:: hello.readOnly + + A boolean value that, when ``true``, indicates that the + :binary:`~bin.mongod` or :binary:`~bin.mongos` is running in read-only mode. + +.. data:: hello.compression + + An array listing the compression algorithms used or available for + use (i.e. common to both the client and the :binary:`~bin.mongod` or + :binary:`~bin.mongos` instance) to compress the communication + between the client and the :binary:`~bin.mongod` or + :binary:`~bin.mongos` instance. + + The field is only available if compression is used. For example: + + - If the :binary:`~bin.mongod` is enabled to use both the + ``snappy,zlib`` compressors and a client has specified ``zlib``, + the :data:`~hello.compression` field would contain: + + .. code-block:: javascript + + "compression": [ "zlib" ] + + - If the :binary:`~bin.mongod` is enabled to use both the + ``snappy,zlib`` compressors and a client has specified ``zlib,snappy``, + the :data:`~hello.compression` field would contain: + + .. code-block:: javascript + + "compression": [ "zlib", "snappy" ] + + - If the :binary:`~bin.mongod` is enabled to use the + ``snappy`` compressor and a client has specified ``zlib,snappy``, + the :data:`~hello.compression` field would contain : + + .. code-block:: javascript + + "compression": [ "snappy" ] + + - If the :binary:`~bin.mongod` is enabled to use the ``snappy`` + compressor and a client has specified ``zlib`` or the client has + specified no compressor, the field is omitted. + + That is, if the client does not specify compression or if the client + specifies a compressor not enabled for the connected + :binary:`~bin.mongod` or :binary:`~bin.mongos` instance, the field + does not return. + +.. data:: hello.saslSupportedMechs + + An array of SASL mechanisms used to create the user's credential or + credentials. Supported SASL mechanisms are: + + - ``GSSAPI`` + - ``SCRAM-SHA-256`` + - ``SCRAM-SHA-1`` + + The field is returned only when the command is run with the + ``saslSupportedMechs`` field: + + .. code-block:: javascript + + db.runCommand( { hello: 1, saslSupportedMechs: "" } ) + +Sharded Instances +~~~~~~~~~~~~~~~~~ + +:binary:`~bin.mongos` instances add the following field to the +:dbcommand:`hello` response document: + +.. data:: hello.msg + + Contains the value ``isdbgrid`` when :dbcommand:`hello` + returns from a :binary:`~bin.mongos` instance. + +Replica Sets +~~~~~~~~~~~~ + +:dbcommand:`hello` contains these fields when returned by a member +of a replica set: + +.. data:: hello.hosts + + An array of strings in the format of ``"[hostname]:[port]"`` that + lists all members of the :term:`replica set` that are neither + :term:`hidden `, :term:`passive `, + nor :term:`arbiters `. + + Drivers use this array and the :data:`hello.passives` to determine + which members to read from. + +.. data:: hello.setName + + The name of the current :replica set. + +.. data:: hello.setVersion + + The current replica set config version. + +.. data:: hello.secondary + + A boolean value that, when ``true``, indicates if the + :binary:`~bin.mongod` is a :term:`secondary` member of a :term:`replica + set`. + +.. data:: hello.passives + + An array of strings in the format of ``"[hostname]:[port]"`` + listing all members of the :term:`replica set` which have a + :rsconf:`members[n].priority` of ``0``. + + This field only appears if there is at least one member with a + :rsconf:`members[n].priority` of ``0``. + + Drivers use this array and the :data:`hello.hosts` to determine + which members to read from. + +.. data:: hello.arbiters + + An array of strings in the format of ``"[hostname]:[port]"`` + listing all members of the :term:`replica set` that are + :term:`arbiters `. + + This field only appears if there is at least one arbiter in the + replica set. + +.. data:: hello.primary + + A string in the format of ``"[hostname]:[port]"`` listing the + current :term:`primary` member of the replica set. + +.. data:: hello.arbiterOnly + + A boolean value that , when ``true``, indicates that the current + instance is an :term:`arbiter`. The :data:`~hello.arbiterOnly` + field is only present, if the instance is an arbiter. + +.. data:: hello.passive + + A boolean value that, when ``true``, indicates that the current + instance is :term:`passive `. The + :data:`~hello.passive` field is only present for members with a + :rsconf:`members[n].priority` of ``0``. + +.. data:: hello.hidden + + A boolean value that, when ``true``, indicates that the current + instance is :term:`hidden `. The + :data:`~hello.hidden` field is only present for hidden members. + +.. data:: hello.tags + + .. include:: /includes/fact-tags-field.rst + + .. seealso:: :rsconf:`members[n].tags` + +.. data:: hello.me + + The ``[hostname]:[port]`` of the member that returned + :dbcommand:`hello`. + +.. data:: hello.electionId + + A unique identifier for each election. Included only in the output + of :dbcommand:`hello` for the :term:`primary`. Used by clients + to determine when elections occur. + +.. data:: hello.lastWrite + + A document containing :term:`optime` and date information for the + database's most recent write operation. + + .. data:: hello.lastWrite.opTime + + An object giving the :term:`optime` of the last write operation. + + .. data:: hello.lastWrite.lastWriteDate + + A date object containing the + time of the last write operation. + + .. data:: hello.lastWrite.majorityOpTime + + An object giving the :term:`optime` of the last write operation + readable by :readconcern:`majority <"majority">` reads. + + .. data:: hello.lastWrite.majorityWriteDate + + A date object containing the + time of the last write operation readable by + :readconcern:`majority <"majority">` reads. + +For details on the ``ok`` status field, the ``operationTime`` field, +and the ``$clusterTime`` field, see +:ref:`Command Response `. diff --git a/source/reference/command/isMaster.txt b/source/reference/command/isMaster.txt index 80221d5679f..b03a16d6e81 100644 --- a/source/reference/command/isMaster.txt +++ b/source/reference/command/isMaster.txt @@ -15,6 +15,8 @@ Definition .. dbcommand:: isMaster + .. deprecated:: 4.2.10 Use :dbcommand:`hello` instead. + :dbcommand:`isMaster` returns a document that describes the role of the :binary:`~bin.mongod` instance. If the optional field ``saslSupportedMechs`` is specified, the command also returns an diff --git a/source/reference/command/isdbgrid.txt b/source/reference/command/isdbgrid.txt index 24f018b4340..2179b70480c 100644 --- a/source/reference/command/isdbgrid.txt +++ b/source/reference/command/isdbgrid.txt @@ -40,7 +40,7 @@ isdbgrid "ok" : 0 } - You can instead use the :dbcommand:`isMaster` command to determine + You can instead use the :dbcommand:`hello` command to determine connection to a :binary:`~bin.mongos`. When connected to a - :binary:`~bin.mongos`, the :dbcommand:`isMaster` command returns a document that + :binary:`~bin.mongos`, the :dbcommand:`hello` command returns a document that contains the string ``isdbgrid`` in the ``msg`` field. diff --git a/source/reference/command/nav-replication.txt b/source/reference/command/nav-replication.txt index 9a182001a59..6d87b92d939 100644 --- a/source/reference/command/nav-replication.txt +++ b/source/reference/command/nav-replication.txt @@ -24,9 +24,13 @@ Replication Commands - Internal command that applies :term:`oplog` entries to the current data set. + * - :dbcommand:`hello` + + - Displays information about this member's role in the replica set, including whether it is the primary. + * - :dbcommand:`isMaster` - - Displays information about this member's role in the replica set, including whether it is the master. + - *Deprecated* Use :dbcommand:`hello` instead. * - :dbcommand:`replSetAbortPrimaryCatchUp` @@ -70,10 +74,11 @@ Replication Commands .. toctree:: - :titlesonly: - :hidden: + :titlesonly: + :hidden: /reference/command/applyOps + /reference/command/hello /reference/command/isMaster /reference/command/replSetAbortPrimaryCatchUp /reference/command/replSetFreeze diff --git a/source/reference/method.txt b/source/reference/method.txt index 130a273c82b..62a3866551c 100644 --- a/source/reference/method.txt +++ b/source/reference/method.txt @@ -488,6 +488,10 @@ Database - Provides access to the specified database. + * - :method:`db.hello()` + + - Returns a document that reports the state of the replica set. + * - :method:`db.help()` - Displays descriptions of common ``db`` object methods. @@ -498,7 +502,7 @@ Database * - :method:`db.isMaster()` - - Returns a document that reports the state of the replica set. + - *Deprecated*. Use :method:`db.hello()` instead. * - :method:`db.killOp()` diff --git a/source/reference/method/db.hello.txt b/source/reference/method/db.hello.txt new file mode 100644 index 00000000000..caabf1f4bc6 --- /dev/null +++ b/source/reference/method/db.hello.txt @@ -0,0 +1,26 @@ +========== +db.hello() +========== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. method:: db.hello() + + .. versionadded:: 4.2.10 (and 4.0.21 and 3.6.21) + + Returns a document that describes the role of the :binary:`~bin.mongod` + instance. + + If the :binary:`~bin.mongod` is a member of a :term:`replica set`, then + the :data:`~hello.isWritablePrimary` and :data:`~hello.secondary` + fields report if the instance is the :term:`primary` or if it is a + :term:`secondary` member of the replica set. + + .. see:: :dbcommand:`hello` for the complete documentation of + the output of :method:`db.hello()`. diff --git a/source/reference/method/db.isMaster.txt b/source/reference/method/db.isMaster.txt index 0558d720e30..1961cafb819 100644 --- a/source/reference/method/db.isMaster.txt +++ b/source/reference/method/db.isMaster.txt @@ -12,6 +12,8 @@ db.isMaster() .. method:: db.isMaster() + .. deprecated:: 4.2.10 Use :method:`db.hello()` instead. + Returns a document that describes the role of the :binary:`~bin.mongod` instance. diff --git a/source/reference/method/js-database.txt b/source/reference/method/js-database.txt index 9eace9d1428..7a0aa57c2ca 100644 --- a/source/reference/method/js-database.txt +++ b/source/reference/method/js-database.txt @@ -120,6 +120,10 @@ Database Methods - Provides access to the specified database. + * - :method:`db.hello()` + + - Returns a document that reports the state of the replica set. + * - :method:`db.help()` - Displays descriptions of common ``db`` object methods. @@ -130,7 +134,7 @@ Database Methods * - :method:`db.isMaster()` - - Returns a document that reports the state of the replica set. + - *Deprecated*. Use :method:`db.hello()` instead. * - :method:`db.killOp()` @@ -243,6 +247,7 @@ Database Methods /reference/method/db.getProfilingStatus /reference/method/db.getReplicationInfo /reference/method/db.getSiblingDB + /reference/method/db.hello /reference/method/db.help /reference/method/db.hostInfo /reference/method/db.isMaster diff --git a/source/reference/mongodb-wire-protocol.txt b/source/reference/mongodb-wire-protocol.txt index 46773dab6fc..89387934231 100644 --- a/source/reference/mongodb-wire-protocol.txt +++ b/source/reference/mongodb-wire-protocol.txt @@ -121,7 +121,8 @@ Request Opcodes ~~~~~~~~~~~~~~~ .. note:: - Starting with MongoDB 2.6 and :data:`~isMaster.maxWireVersion` ``3``, + + Starting with MongoDB 2.6 and :data:`~hello.maxWireVersion` ``3``, MongoDB drivers use the :ref:`database commands` :dbcommand:`insert`, :dbcommand:`update`, and :dbcommand:`delete` instead of ``OP_INSERT``, ``OP_UPDATE``, and ``OP_DELETE`` for diff --git a/source/reference/replica-configuration.txt b/source/reference/replica-configuration.txt index dedb37d8c36..b064c848acd 100644 --- a/source/reference/replica-configuration.txt +++ b/source/reference/replica-configuration.txt @@ -260,7 +260,7 @@ Replica Set Configuration Fields When this value is ``true``, the replica set hides this instance and does not include the member in the output of - :method:`db.isMaster()` or :dbcommand:`isMaster`. This prevents + :method:`db.hello()` or :dbcommand:`hello`. This prevents read operations (i.e. queries) from ever reaching this host by way of secondary :term:`read preference`. diff --git a/source/reference/replication.txt b/source/reference/replication.txt index 293d8da0d06..524de57f0bf 100644 --- a/source/reference/replication.txt +++ b/source/reference/replication.txt @@ -99,9 +99,14 @@ Replication Database Commands - Internal command that applies :term:`oplog` entries to the current data set. + * - :dbcommand:`hello` + + - Displays information about this member's role in the replica set, + including whether it is the primary. + * - :dbcommand:`isMaster` - - Displays information about this member's role in the replica set, including whether it is the master. + - *Deprecated*. Use :method:`db.hello()` instead. * - :dbcommand:`replSetAbortPrimaryCatchUp` diff --git a/source/reference/security-client-side-query-aggregation-support.txt b/source/reference/security-client-side-query-aggregation-support.txt index afa7fd045b1..3bdf8d07491 100644 --- a/source/reference/security-client-side-query-aggregation-support.txt +++ b/source/reference/security-client-side-query-aggregation-support.txt @@ -71,8 +71,9 @@ field level encryption pass these commands directly to the - :dbcommand:`getMore` [#]_ - :dbcommand:`authenticate` - :dbcommand:`getnonce` +- :dbcommand:`hello` - :dbcommand:`logout` -- :dbcommand:`isMaster` +- :dbcommand:`isMaster` (deprecated) - :dbcommand:`abortTransaction` - :dbcommand:`commitTransaction` - :dbcommand:`endSessions` diff --git a/source/tutorial/configure-a-hidden-replica-set-member.txt b/source/tutorial/configure-a-hidden-replica-set-member.txt index 7a8e941ca63..04d26864c8a 100644 --- a/source/tutorial/configure-a-hidden-replica-set-member.txt +++ b/source/tutorial/configure-a-hidden-replica-set-member.txt @@ -68,7 +68,7 @@ to configure by its array index in the After re-configuring the set, this secondary member has a priority of ``0`` so that it cannot become primary and is hidden. The other members in the set will not advertise the hidden member in the -:dbcommand:`isMaster` or :method:`db.isMaster()` output. +:dbcommand:`hello` command or :method:`db.hello()` method output. .. include:: /includes/fact-rs-conf-array-index.rst diff --git a/source/tutorial/expand-replica-set.txt b/source/tutorial/expand-replica-set.txt index c82ab1495ea..cb328a8b2d7 100644 --- a/source/tutorial/expand-replica-set.txt +++ b/source/tutorial/expand-replica-set.txt @@ -152,7 +152,7 @@ Add a Member to an Existing Replica Set You can only add members while connected to the primary. If you do not know which member is the primary, log into any member of the - replica set and issue the :method:`db.isMaster()` command. + replica set and issue the :method:`db.hello()` command. #. Use :method:`rs.add()` to add the new member to the replica set. Pass the :rsconf:`member configuration document ` to the diff --git a/source/tutorial/remove-replica-set-member.txt b/source/tutorial/remove-replica-set-member.txt index d7ef0ce877e..c43957a2580 100644 --- a/source/tutorial/remove-replica-set-member.txt +++ b/source/tutorial/remove-replica-set-member.txt @@ -22,7 +22,7 @@ Remove a Member Using ``rs.remove()`` method. #. Connect to the replica set's current :term:`primary`. To determine - the current primary, use :method:`db.isMaster()` while connected to + the current primary, use :method:`db.hello()` while connected to any member of the replica set. #. Use :method:`rs.remove()` in either of the following forms to @@ -53,7 +53,7 @@ here. method. #. Connect to the replica set's current :term:`primary`. To determine - the current primary, use :method:`db.isMaster()` while connected to + the current primary, use :method:`db.hello()` while connected to any member of the replica set. #. Issue the :method:`rs.conf()` method to view the current diff --git a/source/tutorial/restore-sharded-cluster.txt b/source/tutorial/restore-sharded-cluster.txt index 25fcb5850bb..5dd9241594c 100644 --- a/source/tutorial/restore-sharded-cluster.txt +++ b/source/tutorial/restore-sharded-cluster.txt @@ -90,26 +90,26 @@ Shut Down Running MongoDB Processes use admin db.shutdownServer() - For hosts running a :binary:`mongod `, connect a + For hosts running a :binary:`mongod `, connect a :binary:`mongo ` shell to the ``mongod`` and - run :method:`db.isMaster()`: + run :method:`db.hello()`: - * If :data:`~isMaster.ismaster` is false, the ``mongod`` is a - :term:`secondary ` member of a replica set. You + * If :data:`~hello.isWritablePrimary` is false, the ``mongod`` is a + :term:`secondary ` member of a replica set. You can shut it down by running :method:`db.shutdownServer()` from the ``admin`` database. - * If :data:`~isMaster.ismaster` is true, the ``mongod`` is the + * If :data:`~hello.isWritablePrimary` is true, the ``mongod`` is the :term:`primary ` member of a replica set. Shut down the secondary members of the replica set *first*. Use :method:`rs.status()` to identify the other members of the replica set. - The primary automatically steps down after it detects a + The primary automatically steps down after it detects a majority of members are offline. After it steps down - (:method:`db.isMaster` returns - :data:`ismaster: false `), you can safely - shut down the ``mongod`` + (:method:`db.hello` returns + :data:`isWritablePrimary: false `), you can + safely shut down the ``mongod``. Prepare Data Directory Create a directory on the target host for the restored database diff --git a/source/tutorial/use-database-commands.txt b/source/tutorial/use-database-commands.txt index 2859d5f06db..3c2478f72d5 100644 --- a/source/tutorial/use-database-commands.txt +++ b/source/tutorial/use-database-commands.txt @@ -25,12 +25,12 @@ Database Command Form You specify a command first by constructing a standard :term:`BSON` document whose first key is the name of the command. For example, -specify the :dbcommand:`isMaster` command using the following +specify the :dbcommand:`hello` command using the following :term:`BSON` document: .. code-block:: javascript - { isMaster: 1 } + { hello: 1 } .. _issue-commands: @@ -43,7 +43,7 @@ commands called :method:`db.runCommand()`. The following operation in .. code-block:: javascript - db.runCommand( { isMaster: 1 } ) + db.runCommand( { hello: 1 } ) Many :ecosystem:`drivers ` provide an equivalent for the :method:`db.runCommand()` method. Internally, running commands @@ -52,7 +52,7 @@ against the :term:`$cmd` collection. Many common commands have their own shell helpers or wrappers in the :binary:`~bin.mongo` shell and drivers, such as the -:method:`db.isMaster()` method in the :binary:`~bin.mongo` JavaScript +:method:`db.hello()` method in the :binary:`~bin.mongo` JavaScript shell. You can use the ``maxTimeMS`` option to specify a time limit for the