Skip to content

Commit 4d5383a

Browse files
committed
Adding autopilot parameters
1 parent b029c13 commit 4d5383a

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

articles/cosmos-db/mongodb-custom-commands.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,15 @@ The create collection extension command creates a new MongoDB collection. The da
155155

156156
The following table describes the parameters within the command:
157157

158-
|**Field**|**Type** |**Description** |
158+
| **Field** | **Type** | **Required** | **Description** |
159159
|---------|---------|---------|
160-
| customAction | string | Name of the custom command. Must be "CreateCollection" |
161-
| collection | string | Name of the collection |
162-
| offerThroughput | int | Provisioned Throughput to set on the database. It's an Optional parameter |
163-
| shardKey | string | Shard Key path to create a sharded collection. It's an Optional parameter |
160+
| customAction | string | Required | Name of the custom command. Must be "CreateCollection". |
161+
| collection | string | Required | Name of the collection. No special characters are allowed. |
162+
| offerThroughput | int | Optional* | Provisioned Throughput to set on the database. If it isn't provided, it will default to the minimum, 400 RU/s. * To specify throughput beyong 10,000 RU/s, the `shardKey` parameter will be required. |
163+
| shardKey | string | Optional | Shard Key path to create a sharded collection. If it is specified, all documents inserted will require this value. |
164+
| autopilotTier | int | Optional* | The tier of Autopilot RU/s. Accepted values are 1 through 4, which map to each one of the [Autopilot tiers](https://docs.microsoft.com/azure/cosmos-db/provision-throughput-autopilot#autopilot-limits) respectively. Can't be specified alongside the `offerThroughput` parameter. Any value greater than 1 will require the `shardKey` parameter. |
165+
| autopilotAutoUpgrade | boolean | Optional* | Ability to automatically increase the Autopilot tier. *It requires `autopilotTier` to be specified, as well as the `shardKey` parameter. |
166+
164167

165168
### Output
166169

@@ -179,13 +182,38 @@ db.runCommand({customAction: "CreateCollection", collection: "testCollection", o
179182

180183
**Create a sharded collection**
181184

182-
To create a sharded collection with name "testCollection" and provisioned throughput of 1000 RUs, use the following command:
185+
To create a sharded collection with name "testCollection" and provisioned throughput of 1000 RUs, and a shardkey property "a.b", use the following command:
183186

184187
```shell
185188
use test
186189
db.runCommand({customAction: "CreateCollection", collection: "testCollection", offerThroughput: 1000, shardKey: "a.b" });
187190
```
188191

192+
**Create an unsharded Autopilot collection**
193+
194+
To create an unsharded Autopilot collection with name "testCollection" and with Autopilot Tier 1, which maps to 4,000 RUs, use the following command:
195+
196+
```shell
197+
use test
198+
db.runCommand({customAction: "CreateCollection", collection: "testCollection", autopilotTier: 1 });
199+
```
200+
201+
**Create a sharded Autopilot collection**
202+
203+
To create a sharded Autopilot collection with name "testCollection" and with Autopilot Tier 3, which maps to 100,000 RUs, and a shardKey property "a.b", use the following command:
204+
205+
```shell
206+
use test
207+
db.runCommand({customAction: "CreateCollection", collection: "testCollection", autopilotTier: 3, shardKey: "a.b" });
208+
```
209+
210+
To create a sharded Autopilot collection with name "testCollection" and with Autopilot Tier 2, which maps to 20,000 RUs, a shardKey property "a.b", and the ability to auto increase the tier when needed, use the following command:
211+
212+
```shell
213+
use test
214+
db.runCommand({customAction: "CreateCollection", collection: "testCollection", autopilotTier: 2, autopilotAutoUpgrade: true, shardKey: "a.b" });
215+
```
216+
189217
## <a id="update-collection"></a> Update collection
190218

191219
The update collection extension command updates the properties associated with the specified collection.

0 commit comments

Comments
 (0)