From 091d35e44e2f8bfba85a5f311ca1870aa33ff0c4 Mon Sep 17 00:00:00 2001 From: Bob Grabar Date: Wed, 19 Jun 2013 12:47:20 -0400 Subject: [PATCH] this one is up-to-date --- .../reference/method/sh.moveChunk-param.yaml | 38 +++++++++-------- source/reference/method/sh.moveChunk.txt | 31 +++++++------- .../method/sh.shardCollection-param.yaml | 42 +++++++++++-------- .../reference/method/sh.shardCollection.txt | 37 ++++++++-------- .../method/sh.waitForBalancer-param.yaml | 40 ++++++++++-------- .../reference/method/sh.waitForBalancer.txt | 27 +++--------- .../method/sh.waitForPingChange-param.yaml | 37 ++++++++-------- .../reference/method/sh.waitForPingChange.txt | 15 +++---- 8 files changed, 133 insertions(+), 134 deletions(-) diff --git a/source/reference/method/sh.moveChunk-param.yaml b/source/reference/method/sh.moveChunk-param.yaml index c625080fddd..d9f43e7198c 100644 --- a/source/reference/method/sh.moveChunk-param.yaml +++ b/source/reference/method/sh.moveChunk-param.yaml @@ -1,33 +1,37 @@ object: - name: - type: + name: sh.moveChunk() + type: method field: optional: false type: param -name: -type: +name: namespace +type: string position: 1 -description: "" +description: | + The :term:`namespace` of the sharded collection that contains the + chunk to migrate. --- object: - name: - type: + name: sh.moveChunk() + type: method field: - optional: + optional: false type: param -name: -type: +name: query +type: document position: 2 -description: "" +description: | + An equality match on the shard key. This selects the chunk to move. --- object: - name: - type: + name: sh.moveChunk() + type: method field: - optional: + optional: false type: param -name: -type: +name: destination +type: string position: 3 -description: "" +description: | + The name of the shard to move. ... diff --git a/source/reference/method/sh.moveChunk.txt b/source/reference/method/sh.moveChunk.txt index 128444ca3fe..e7dedd94205 100644 --- a/source/reference/method/sh.moveChunk.txt +++ b/source/reference/method/sh.moveChunk.txt @@ -4,26 +4,16 @@ sh.moveChunk() .. default-domain:: mongodb -.. method:: sh.moveChunk(collection, query, destination) +Definition +---------- - :param string collection: - - Specifies the sharded collection containing the chunk to - migrate. - - :param document query: - - A document that specifies an equality match on the shard key, - which selects the chunk to move. - - :param string destination: - - Specifies the name of the shard that you wish to move the - designated chunk to. +.. method:: sh.moveChunk(namespace, query, destination) Moves the chunk containing the document specified by the ``query`` to the shard described by ``destination``. + .. include:: /reference/method/sh.moveChunk-param.rst + This method provides a wrapper around the :dbcommand:`moveChunk`. In most circumstances, allow the :term:`balancer` to automatically migrate :term:`chunks `, @@ -33,3 +23,14 @@ sh.moveChunk() :method:`sh.splitFind()`, :doc:`/sharding`, and :ref:`chunk migration `. +Example +------- + +Given the ``people`` collection in the ``records`` database, the +following command finds the chunk that contains the documents with the +``zipcode`` field set to ``53187`` and then moves that chunk to the +shard named ``shard0019``: + +.. code-block:: javascript + + sh.moveChunk("records.people", { zipcode: 53187 }, "shard0019") diff --git a/source/reference/method/sh.shardCollection-param.yaml b/source/reference/method/sh.shardCollection-param.yaml index c625080fddd..1d2f2300b6b 100644 --- a/source/reference/method/sh.shardCollection-param.yaml +++ b/source/reference/method/sh.shardCollection-param.yaml @@ -1,33 +1,41 @@ object: - name: - type: + name: sh.shardCollection() + type: method field: optional: false type: param -name: -type: +name: namespace +type: string position: 1 -description: "" +description: | + The :term:`namespace` of the collection to shard. --- object: - name: - type: + name: sh.shardCollection() + type: method field: - optional: + optional: false type: param -name: -type: +name: shard key +type: document position: 2 -description: "" +description: | + A :term:`document` that specifies the :term:`shard key` to use to + :term:`partition` and distribute objects among the shards. A shard key + may be one field or multiple fields. A shard key with multiple fields + is called a "compound shard key." --- object: - name: - type: + name: sh.shardCollection() + type: method field: - optional: + optional: false type: param -name: -type: +name: unique +type: Boolean position: 3 -description: "" +description: | + When true, ensures that the underlying index enforces a unique + constraint. :term:`Hashed shard keys ` do not + support unique constraints. ... diff --git a/source/reference/method/sh.shardCollection.txt b/source/reference/method/sh.shardCollection.txt index 7052be5c8b6..d4ae1443934 100644 --- a/source/reference/method/sh.shardCollection.txt +++ b/source/reference/method/sh.shardCollection.txt @@ -4,26 +4,14 @@ sh.shardCollection() .. default-domain:: mongodb -.. method:: sh.shardCollection(namespace, key, unique) +Definition +---------- - :param string namespace: The :term:`namespace` of the collection to shard. +.. method:: sh.shardCollection(namespace, shard key, unique) - :param document key: + Shards a collection according to a specified :term:`shard key`. - A :term:`document` containing a :term:`shard key` that the - sharding system uses to :term:`partition` and distribute objects - among the shards. - - :param boolean unique: - - When true, the ``unique`` option ensures that the underlying - index enforces a unique constraint. :term:`Hashed shard keys - ` do not support unique constraints. - - Shards the named collection, according to the specified - :term:`shard key`. Specify shard keys in the form of a :term:`document`. - Shard keys may refer to a single document field, or more typically - several document fields to form a "compound shard key." + .. include:: /reference/method/sh.shardCollection-param.rst .. versionadded:: 2.4 Use the form ``{field: "hashed"}`` to create a @@ -36,8 +24,17 @@ sh.shardCollection() :dbcommand:`shardCollection` for additional options, :doc:`/sharding`, :doc:`/core/sharded-clusters` for an overview of - sharding with MongoDB and - :doc:`/tutorial/deploy-shard-cluster` for a tutorial. - Also review :ref:`sharding-shard-key` regarding choosing a shard + sharding, + :doc:`/tutorial/deploy-shard-cluster` for a tutorial, and + :ref:`sharding-shard-key` for choosing a shard key. +Example +------- + +Given the ``people`` collection in the ``records`` database, the +following command shards the collection by the ``zipcode`` field: + +.. code-block:: javascript + + sh.shardCollection("records.people", { zipcode: 1} ) diff --git a/source/reference/method/sh.waitForBalancer-param.yaml b/source/reference/method/sh.waitForBalancer-param.yaml index c625080fddd..e229b7c1ca7 100644 --- a/source/reference/method/sh.waitForBalancer-param.yaml +++ b/source/reference/method/sh.waitForBalancer-param.yaml @@ -1,33 +1,37 @@ object: - name: - type: + name: sh.waitForBalancer() + type: method field: - optional: false + optional: true type: param -name: -type: +name: wait +type: Boolean position: 1 -description: "" +description: | + Set this to ``true`` to wait for the balancer lock to change. The + default is ``false``, which waits until balancing stops. --- object: - name: - type: + name: sh.waitForBalancer() + type: method field: - optional: + optional: false type: param -name: -type: +name: timeout +type: integer position: 2 -description: "" +description: | + Milliseconds to wait. --- object: - name: - type: + name: sh.waitForBalancer() + type: method field: - optional: + optional: false type: param -name: -type: +name: interval +type: integer position: 3 -description: "" +description: | + Milliseconds to sleep. ... diff --git a/source/reference/method/sh.waitForBalancer.txt b/source/reference/method/sh.waitForBalancer.txt index 705498eaa88..57efad7b69b 100644 --- a/source/reference/method/sh.waitForBalancer.txt +++ b/source/reference/method/sh.waitForBalancer.txt @@ -4,27 +4,12 @@ sh.waitForBalancer() .. default-domain:: mongodb -.. method:: sh.waitForBalancer(onOrNot, timeout, interval) +Definition +---------- - :param Boolean onOrNot: Whether to wait for the lock to be - on (``true``) or off (``false``). - - :param integer timeout: Milliseconds to wait. - - :param integer interval: Milliseconds to sleep. +.. method:: sh.waitForBalancer(wait, timeout, interval) + This is an internal method that waits for a change in the state of + the balancer. - :method:`sh.waitForBalancer()` is an internal method that waits for - a change in the state of the balancer. - -.. seealso:: - - - :method:`sh.enableBalancing()` - - :method:`sh.disableBalancing()` - - :method:`sh.getBalancerHost()` - - :method:`sh.getBalancerState()` - - :method:`sh.isBalancerRunning()` - - :method:`sh.setBalancerState()` - - :method:`sh.startBalancer()` - - :method:`sh.stopBalancer()` - - :method:`sh.waitForBalancerOff()` + .. include:: /reference/method/sh.waitForBalancer-param.rst diff --git a/source/reference/method/sh.waitForPingChange-param.yaml b/source/reference/method/sh.waitForPingChange-param.yaml index c625080fddd..9a7117aad15 100644 --- a/source/reference/method/sh.waitForPingChange-param.yaml +++ b/source/reference/method/sh.waitForPingChange-param.yaml @@ -1,33 +1,36 @@ object: - name: - type: + name: sh.waitForPingChange() + type: method field: optional: false type: param -name: -type: +name: active pings +type: array position: 1 -description: "" +description: | + An array of active pings from the :data:`~config.mongos` collection. --- object: - name: - type: + name: sh.waitForPingChange() + type: method field: - optional: + optional: false type: param -name: -type: +name: timeout +type: integer position: 2 -description: "" +description: | + Milliseconds to wait for a change in ping state. --- object: - name: - type: + name: sh.waitForPingChange() + type: method field: - optional: + optional: false type: param -name: -type: +name: interval +type: integer position: 3 -description: "" +description: | + Milliseconds to sleep in each waiting cycle. ... diff --git a/source/reference/method/sh.waitForPingChange.txt b/source/reference/method/sh.waitForPingChange.txt index 58e3257669e..48fa146cade 100644 --- a/source/reference/method/sh.waitForPingChange.txt +++ b/source/reference/method/sh.waitForPingChange.txt @@ -4,14 +4,11 @@ sh.waitForPingChange() .. default-domain:: mongodb -.. method:: sh.waitForPingChange(activepings, timeout, interval) +Definition +---------- - :param array activepings: An array of active pings from the - ``config.mongos`` collection. - - :param integer timeout: Milliseconds to wait for a change in ping state. - - :param integer interval: Milliseconds to sleep in each waiting cycle. +.. method:: sh.waitForPingChange(active pings, timeout, interval) - :method:`sh.waitForPingChange()` waits for a change in ping state - of the one of the ``activepings``. + Waits for a change in ping state of one of the ``activepings``. + + .. include:: /reference/method/sh.waitForPingChange-param.rst