@@ -118,7 +118,7 @@ Query and Update Methods
118
118
119
119
.. function:: db.collection.insert(document)
120
120
121
- :param document: Specifies a document to save to the ``collection``.
121
+ :param document: Specify a document to save to the ``collection``.
122
122
123
123
:param array documents: Optional alternate. After version 2.2, if
124
124
you pass an array to :func:`insert()
@@ -132,11 +132,11 @@ Query and Update Methods
132
132
133
133
.. function:: db.collection.save(document)
134
134
135
- :param document: Specifies a document to save to the ``collection``.
135
+ :param document: Specify a document to save to the ``collection``.
136
136
137
137
If :term:`document` has an `_id` field, then perform an
138
- :func:`db.collection.update()` with no
139
- :ref:`update-operators <update-operators>`. Otherwise, insert a new
138
+ :func:`db.collection.update()` with no :ref:`update-operators
139
+ <update-operators>` as an :term:`upsert `. Otherwise, insert a new
140
140
document with fields from `document` and a newly generated
141
141
ObjectId() for the ``_id`` field.
142
142
@@ -474,17 +474,17 @@ Data Aggregation
474
474
The :func:`db.collection.group()` accepts a single :term:`document` that
475
475
contains the following:
476
476
477
- :field key: Specify one or more fields to group by.
477
+ :field key: Specifies one or more fields to group by.
478
478
479
- :field reduce: Specify a reduce function that operates over all the
479
+ :field reduce: Specifies a reduce function that operates over all the
480
480
iterated objects. Typically these aggregator
481
481
functions perform some sort of summing or
482
482
counting. The reduce function takes two arguments:
483
483
the current document and an aggregation counter
484
484
object.
485
485
486
486
:field initial: The starting value of the aggregation counter
487
- object.
487
+ object.
488
488
489
489
:field keyf: Optional. An optional function that returns a "key
490
490
object" for use as the grouping key. Use
@@ -728,8 +728,8 @@ Database
728
728
729
729
:param string password: Specifies the corresponding password.
730
730
731
- :param boolean readOnly: Optionally restricts a user to read-privileges
732
- only. Defaults to false.
731
+ :param boolean readOnly: Optional. Restrict a user to
732
+ read-privileges only. Defaults to false.
733
733
734
734
Use this function to create new database users, by specifying a
735
735
username and password as arguments to the command. If you want to
@@ -1110,7 +1110,7 @@ Database
1110
1110
1111
1111
.. function:: db.setProfilingLevel(level, [slowms])
1112
1112
1113
- :param level: Specify a profiling level, see list of possible
1113
+ :param level: Specifies a profiling level, see list of possible
1114
1114
values below.
1115
1115
1116
1116
:param slowms: Optionally modify the threshold for the profile to
@@ -1730,6 +1730,75 @@ Sharding
1730
1730
cluster`, including data regarding the distribution of
1731
1731
chunks.
1732
1732
1733
+ .. function:: sh.addShardTag(shard, tag)
1734
+
1735
+ .. versionadded:: 2.2
1736
+
1737
+ :param shard: Specifies the name of the shard that you want to give
1738
+ a specific tag.
1739
+
1740
+ :param tag: Specifies the name of the tag that you want to add to
1741
+ the shard.
1742
+
1743
+ :func:`sh.addShardTag()` associates a shard with a tag or
1744
+ identifier. MongoDB can use these identifiers, to "home" or attach
1745
+ (i.e. with :func:`sh.addTagRange()`) specific data to a specific
1746
+ shard.
1747
+
1748
+ Always issue :func:`sh.addShardTag()` when connected to a
1749
+ :program:`mongos` instance. The following example adds three tags,
1750
+ ``LGA``, ``EWR``, and ``JFK``, to three shards:
1751
+
1752
+ .. code-block:: javascript
1753
+
1754
+ sh.addShardTag("shard0000", "LGA")
1755
+ sh.addShardTag("shard0001", "EWR")
1756
+ sh.addShardTag("shard0002", "JFK")
1757
+
1758
+ .. function:: sh.addTagRange(namespace, minimum, maximum, tag)
1759
+
1760
+ .. versionadded:: 2.2
1761
+
1762
+ :param namespace: Specifies the namespace, in the form of
1763
+ ``<database>.<collection>`` of the sharded
1764
+ collection that you would like to tag.
1765
+
1766
+ :param minimum: Specifies the minimum value of the :term:`shard
1767
+ key` range to include in the tag. Specify the
1768
+ minimum value in the form of
1769
+ ``<fieldname>:<value>``.
1770
+
1771
+ :param maximum: Specifies the maximum value of the shard key range
1772
+ to include in the tag. Specify the minimum value
1773
+ in the form of ``<fieldname>:<value>``.
1774
+
1775
+ :param tag: Specifies the name of the tag to attach the range
1776
+ specified by the ``minimum`` and ``maximum`` arguments
1777
+ to.
1778
+
1779
+ :func:`sh.addTagRange()` attaches a range of values of the shard
1780
+ key to a shard tag created using the :func:`sh.addShardTag()`
1781
+ helper. Use this operation to ensure that the documents that exist
1782
+ within the specified range exist on shards that have a matching
1783
+ tag.
1784
+
1785
+ Always issue :func:`sh.addTagRange()` when connected to a
1786
+ :program:`mongos` instance.
1787
+
1788
+ .. function:: sh.removeShardTag(shard, tag)
1789
+
1790
+ .. versionadded:: 2.2
1791
+
1792
+ :param shard: Specifies the name of the shard that you want
1793
+ to remove a tag from.
1794
+
1795
+ :param tag: Specifies the name of the tag that you want to remove
1796
+ from the shard.
1797
+
1798
+ Removes the association between a tag and a shard. Always issue
1799
+ :func:`sh.removeShardTag()` when connected to a :program:`mongos`
1800
+ instance.
1801
+
1733
1802
.. function:: sh.help()
1734
1803
1735
1804
:returns: a basic help text for all sharding related shell
0 commit comments