Microsoft.DocumentDB databaseAccounts/mongodbDatabases/collections 2019-12-12

Template format

To create a Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections",
  "apiVersion": "2019-12-12",
  "location": "string",
  "tags": {},
  "properties": {
    "resource": {
      "id": "string",
      "shardKey": {},
      "indexes": [
        {
          "key": {
            "keys": [
              "string"
            ]
          },
          "options": {
            "expireAfterSeconds": "integer",
            "unique": "boolean"
          }
        }
      ]
    },
    "options": {
      "additionalProperties": {},
      "throughput": "string"
    }
  }
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections object

Name Type Required Value
name string Yes Cosmos DB collection name.
type enum Yes collections
-or-
Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections

See Set name and type for child resources.
apiVersion enum Yes 2019-12-12
location string No The location of the resource group to which the resource belongs.
tags object No
properties object Yes Properties to create and update Azure Cosmos DB MongoDB collection. - MongoDBCollectionCreateUpdateProperties object

MongoDBCollectionCreateUpdateProperties object

Name Type Required Value
resource object Yes The standard JSON format of a MongoDB collection - MongoDBCollectionResource object
options object Yes A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - CreateUpdateOptions object

MongoDBCollectionResource object

Name Type Required Value
id string Yes Name of the Cosmos DB MongoDB collection
shardKey object No A key-value pair of shard keys to be applied for the request.
indexes array No List of index keys - MongoIndex object

CreateUpdateOptions object

Name Type Required Value
additionalProperties object No Unmatched properties from the message are deserialized this collection
throughput string No Request Units per second. For example, "throughput": "10000".

MongoIndex object

Name Type Required Value
key object No Cosmos DB MongoDB collection index keys - MongoIndexKeys object
options object No Cosmos DB MongoDB collection index key options - MongoIndexOptions object

MongoIndexKeys object

Name Type Required Value
keys array No List of keys for each MongoDB collection in the Azure Cosmos DB service - string

MongoIndexOptions object

Name Type Required Value
expireAfterSeconds integer No Expire after seconds
unique boolean No Is unique or not

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
Create an Azure Cosmos account for MongoDB API (3.2 or 3.6)

Deploy to Azure
This template creates an Azure Cosmos DB account for MongoDB API (3.2 or 3.6) in two regions using shared database throughput with two collections.
Create an Azure Cosmos account for MongoDB API autoscale

Deploy to Azure
This template creates an Azure Cosmos DB account for MongoDB API (3.2 or 3.6) in two regions using shared autoscale database throughput with two collections.