@@ -34,13 +34,13 @@ content: |
34
34
...
35
35
36
36
---
37
- title : Shard the collection.
38
- ref : new-sharded-tsc-create
37
+ title : Create a hashed index on your collection.
38
+ ref : new-sharded-tsc-index
39
39
stepnum : 3
40
40
level : 4
41
41
content : |
42
- Use the :method:`~sh.shardCollection()` method to shard the
43
- collection .
42
+ Enable sharding on your collection by creating an index that supports
43
+ the :ref:`shard key <shard-key>` .
44
44
45
45
Consider a time series collection with the following properties:
46
46
@@ -67,11 +67,28 @@ content: |
67
67
"speed": 50
68
68
} )
69
69
70
- To shard the collection, run the following command:
70
+ Run the following command to create a hashed index on the
71
+ ``metadata.location`` field:
72
+
73
+ .. code-block:: javascript
74
+
75
+ db.deliverySensor.createIndex( { "metadata.location" : "hashed" } )
76
+
77
+ ---
78
+ title : Shard your collection.
79
+ ref : new-sharded-tsc-create
80
+ stepnum : 4
81
+ level : 4
82
+ content : |
83
+ Use the :method:`~sh.shardCollection()` method to shard the
84
+ collection.
85
+
86
+ To shard the ``deliverySensor`` collection described in the preceding step, run
87
+ the following command:
71
88
72
89
.. code-block:: javascript
73
90
74
- sh.shardCollection( "test.deliverySensor", { "metadata.location": 1 } )
91
+ sh.shardCollection( "test.deliverySensor", { "metadata.location": "hashed" } )
75
92
76
93
In this example, :method:`sh.shardCollection()`:
77
94
0 commit comments