We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages a Mongo Collection within a Cosmos DB Account.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleAccount = Output.Create(Azure.CosmosDB.GetAccount.InvokeAsync(new Azure.CosmosDB.GetAccountArgs
{
Name = "tfex-cosmosdb-account",
ResourceGroupName = "tfex-cosmosdb-account-rg",
}));
var exampleMongoDatabase = new Azure.CosmosDB.MongoDatabase("exampleMongoDatabase", new Azure.CosmosDB.MongoDatabaseArgs
{
ResourceGroupName = exampleAccount.Apply(exampleAccount => exampleAccount.ResourceGroupName),
AccountName = exampleAccount.Apply(exampleAccount => exampleAccount.Name),
});
var exampleMongoCollection = new Azure.CosmosDB.MongoCollection("exampleMongoCollection", new Azure.CosmosDB.MongoCollectionArgs
{
ResourceGroupName = exampleAccount.Apply(exampleAccount => exampleAccount.ResourceGroupName),
AccountName = exampleAccount.Apply(exampleAccount => exampleAccount.Name),
DatabaseName = exampleMongoDatabase.Name,
DefaultTtlSeconds = 777,
ShardKey = "uniqueKey",
Throughput = 400,
Indices =
{
new Azure.CosmosDB.Inputs.MongoCollectionIndexArgs
{
Keys =
{
"_id",
},
Unique = true,
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/cosmosdb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleAccount, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
Name: "tfex-cosmosdb-account",
ResourceGroupName: "tfex-cosmosdb-account-rg",
}, nil)
if err != nil {
return err
}
exampleMongoDatabase, err := cosmosdb.NewMongoDatabase(ctx, "exampleMongoDatabase", &cosmosdb.MongoDatabaseArgs{
ResourceGroupName: pulumi.String(exampleAccount.ResourceGroupName),
AccountName: pulumi.String(exampleAccount.Name),
})
if err != nil {
return err
}
_, err = cosmosdb.NewMongoCollection(ctx, "exampleMongoCollection", &cosmosdb.MongoCollectionArgs{
ResourceGroupName: pulumi.String(exampleAccount.ResourceGroupName),
AccountName: pulumi.String(exampleAccount.Name),
DatabaseName: exampleMongoDatabase.Name,
DefaultTtlSeconds: pulumi.Int(777),
ShardKey: pulumi.String("uniqueKey"),
Throughput: pulumi.Int(400),
Indices: cosmosdb.MongoCollectionIndexArray{
&cosmosdb.MongoCollectionIndexArgs{
Keys: pulumi.StringArray{
pulumi.String("_id"),
},
Unique: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleAccount = azure.cosmosdb.getAccount({
name: "tfex-cosmosdb-account",
resourceGroupName: "tfex-cosmosdb-account-rg",
});
const exampleMongoDatabase = new azure.cosmosdb.MongoDatabase("exampleMongoDatabase", {
resourceGroupName: exampleAccount.then(exampleAccount => exampleAccount.resourceGroupName),
accountName: exampleAccount.then(exampleAccount => exampleAccount.name),
});
const exampleMongoCollection = new azure.cosmosdb.MongoCollection("exampleMongoCollection", {
resourceGroupName: exampleAccount.then(exampleAccount => exampleAccount.resourceGroupName),
accountName: exampleAccount.then(exampleAccount => exampleAccount.name),
databaseName: exampleMongoDatabase.name,
defaultTtlSeconds: "777",
shardKey: "uniqueKey",
throughput: 400,
indices: [{
keys: ["_id"],
unique: true,
}],
});
import pulumi
import pulumi_azure as azure
example_account = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
resource_group_name="tfex-cosmosdb-account-rg")
example_mongo_database = azure.cosmosdb.MongoDatabase("exampleMongoDatabase",
resource_group_name=example_account.resource_group_name,
account_name=example_account.name)
example_mongo_collection = azure.cosmosdb.MongoCollection("exampleMongoCollection",
resource_group_name=example_account.resource_group_name,
account_name=example_account.name,
database_name=example_mongo_database.name,
default_ttl_seconds=777,
shard_key="uniqueKey",
throughput=400,
indices=[azure.cosmosdb.MongoCollectionIndexArgs(
keys=["_id"],
unique=True,
)])
Example coming soon!
Create MongoCollection Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MongoCollection(name: string, args: MongoCollectionArgs, opts?: CustomResourceOptions);@overload
def MongoCollection(resource_name: str,
args: MongoCollectionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MongoCollection(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_name: Optional[str] = None,
database_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
analytical_storage_ttl: Optional[int] = None,
autoscale_settings: Optional[MongoCollectionAutoscaleSettingsArgs] = None,
default_ttl_seconds: Optional[int] = None,
indices: Optional[Sequence[MongoCollectionIndexArgs]] = None,
name: Optional[str] = None,
shard_key: Optional[str] = None,
throughput: Optional[int] = None)func NewMongoCollection(ctx *Context, name string, args MongoCollectionArgs, opts ...ResourceOption) (*MongoCollection, error)public MongoCollection(string name, MongoCollectionArgs args, CustomResourceOptions? opts = null)
public MongoCollection(String name, MongoCollectionArgs args)
public MongoCollection(String name, MongoCollectionArgs args, CustomResourceOptions options)
type: azure:cosmosdb:MongoCollection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MongoCollectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MongoCollectionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MongoCollectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MongoCollectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MongoCollectionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var mongoCollectionResource = new Azure.CosmosDB.MongoCollection("mongoCollectionResource", new()
{
AccountName = "string",
DatabaseName = "string",
ResourceGroupName = "string",
AnalyticalStorageTtl = 0,
AutoscaleSettings = new Azure.CosmosDB.Inputs.MongoCollectionAutoscaleSettingsArgs
{
MaxThroughput = 0,
},
DefaultTtlSeconds = 0,
Indices = new[]
{
new Azure.CosmosDB.Inputs.MongoCollectionIndexArgs
{
Keys = new[]
{
"string",
},
Unique = false,
},
},
Name = "string",
ShardKey = "string",
Throughput = 0,
});
example, err := cosmosdb.NewMongoCollection(ctx, "mongoCollectionResource", &cosmosdb.MongoCollectionArgs{
AccountName: pulumi.String("string"),
DatabaseName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
AnalyticalStorageTtl: pulumi.Int(0),
AutoscaleSettings: &cosmosdb.MongoCollectionAutoscaleSettingsArgs{
MaxThroughput: pulumi.Int(0),
},
DefaultTtlSeconds: pulumi.Int(0),
Indices: cosmosdb.MongoCollectionIndexArray{
&cosmosdb.MongoCollectionIndexArgs{
Keys: pulumi.StringArray{
pulumi.String("string"),
},
Unique: pulumi.Bool(false),
},
},
Name: pulumi.String("string"),
ShardKey: pulumi.String("string"),
Throughput: pulumi.Int(0),
})
var mongoCollectionResource = new MongoCollection("mongoCollectionResource", MongoCollectionArgs.builder()
.accountName("string")
.databaseName("string")
.resourceGroupName("string")
.analyticalStorageTtl(0)
.autoscaleSettings(MongoCollectionAutoscaleSettingsArgs.builder()
.maxThroughput(0)
.build())
.defaultTtlSeconds(0)
.indices(MongoCollectionIndexArgs.builder()
.keys("string")
.unique(false)
.build())
.name("string")
.shardKey("string")
.throughput(0)
.build());
mongo_collection_resource = azure.cosmosdb.MongoCollection("mongoCollectionResource",
account_name="string",
database_name="string",
resource_group_name="string",
analytical_storage_ttl=0,
autoscale_settings={
"max_throughput": 0,
},
default_ttl_seconds=0,
indices=[{
"keys": ["string"],
"unique": False,
}],
name="string",
shard_key="string",
throughput=0)
const mongoCollectionResource = new azure.cosmosdb.MongoCollection("mongoCollectionResource", {
accountName: "string",
databaseName: "string",
resourceGroupName: "string",
analyticalStorageTtl: 0,
autoscaleSettings: {
maxThroughput: 0,
},
defaultTtlSeconds: 0,
indices: [{
keys: ["string"],
unique: false,
}],
name: "string",
shardKey: "string",
throughput: 0,
});
type: azure:cosmosdb:MongoCollection
properties:
accountName: string
analyticalStorageTtl: 0
autoscaleSettings:
maxThroughput: 0
databaseName: string
defaultTtlSeconds: 0
indices:
- keys:
- string
unique: false
name: string
resourceGroupName: string
shardKey: string
throughput: 0
MongoCollection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The MongoCollection resource accepts the following input properties:
- Account
Name string - Database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Analytical
Storage intTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - Autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - Default
Ttl intSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - Indices
List<Mongo
Collection Index> - One or more
indexblocks as defined below. - Name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- string
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- Throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- Account
Name string - Database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Analytical
Storage intTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - Autoscale
Settings MongoCollection Autoscale Settings Args - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - Default
Ttl intSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - Indices
[]Mongo
Collection Index Args - One or more
indexblocks as defined below. - Name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- string
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- Throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name String - database
Name String - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- analytical
Storage IntegerTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - default
Ttl IntegerSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
List<Mongo
Collection Index> - One or more
indexblocks as defined below. - name String
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- String
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- throughput Integer
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name string - database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- analytical
Storage numberTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - default
Ttl numberSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
Mongo
Collection Index[] - One or more
indexblocks as defined below. - name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- string
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- throughput number
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account_
name str - database_
name str - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- resource_
group_ strname - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- analytical_
storage_ intttl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale_
settings MongoCollection Autoscale Settings Args - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - default_
ttl_ intseconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
Sequence[Mongo
Collection Index Args] - One or more
indexblocks as defined below. - name str
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- str
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name String - database
Name String - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- analytical
Storage NumberTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings Property Map - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - default
Ttl NumberSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices List<Property Map>
- One or more
indexblocks as defined below. - name String
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- String
- The name of the key to partition on for sharding. There must not be any other unique index keys.
- throughput Number
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
Outputs
All input properties are implicitly available as output properties. Additionally, the MongoCollection resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- System
Indexes List<MongoCollection System Index> - One or more
system_indexesblocks as defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- System
Indexes []MongoCollection System Index - One or more
system_indexesblocks as defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- system
Indexes List<MongoCollection System Index> - One or more
system_indexesblocks as defined below.
- id string
- The provider-assigned unique ID for this managed resource.
- system
Indexes MongoCollection System Index[] - One or more
system_indexesblocks as defined below.
- id str
- The provider-assigned unique ID for this managed resource.
- system_
indexes Sequence[MongoCollection System Index] - One or more
system_indexesblocks as defined below.
- id String
- The provider-assigned unique ID for this managed resource.
- system
Indexes List<Property Map> - One or more
system_indexesblocks as defined below.
Look up Existing MongoCollection Resource
Get an existing MongoCollection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MongoCollectionState, opts?: CustomResourceOptions): MongoCollection@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_name: Optional[str] = None,
analytical_storage_ttl: Optional[int] = None,
autoscale_settings: Optional[MongoCollectionAutoscaleSettingsArgs] = None,
database_name: Optional[str] = None,
default_ttl_seconds: Optional[int] = None,
indices: Optional[Sequence[MongoCollectionIndexArgs]] = None,
name: Optional[str] = None,
resource_group_name: Optional[str] = None,
shard_key: Optional[str] = None,
system_indexes: Optional[Sequence[MongoCollectionSystemIndexArgs]] = None,
throughput: Optional[int] = None) -> MongoCollectionfunc GetMongoCollection(ctx *Context, name string, id IDInput, state *MongoCollectionState, opts ...ResourceOption) (*MongoCollection, error)public static MongoCollection Get(string name, Input<string> id, MongoCollectionState? state, CustomResourceOptions? opts = null)public static MongoCollection get(String name, Output<String> id, MongoCollectionState state, CustomResourceOptions options)resources: _: type: azure:cosmosdb:MongoCollection get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Account
Name string - Analytical
Storage intTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - Autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - Database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Default
Ttl intSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - Indices
List<Mongo
Collection Index> - One or more
indexblocks as defined below. - Name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Shard
Key string - The name of the key to partition on for sharding. There must not be any other unique index keys.
- System
Indexes List<MongoCollection System Index> - One or more
system_indexesblocks as defined below. - Throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- Account
Name string - Analytical
Storage intTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - Autoscale
Settings MongoCollection Autoscale Settings Args - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - Database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Default
Ttl intSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - Indices
[]Mongo
Collection Index Args - One or more
indexblocks as defined below. - Name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- Shard
Key string - The name of the key to partition on for sharding. There must not be any other unique index keys.
- System
Indexes []MongoCollection System Index Args - One or more
system_indexesblocks as defined below. - Throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name String - analytical
Storage IntegerTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - database
Name String - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- default
Ttl IntegerSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
List<Mongo
Collection Index> - One or more
indexblocks as defined below. - name String
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- shard
Key String - The name of the key to partition on for sharding. There must not be any other unique index keys.
- system
Indexes List<MongoCollection System Index> - One or more
system_indexesblocks as defined below. - throughput Integer
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name string - analytical
Storage numberTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings MongoCollection Autoscale Settings - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - database
Name string - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- default
Ttl numberSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
Mongo
Collection Index[] - One or more
indexblocks as defined below. - name string
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- resource
Group stringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- shard
Key string - The name of the key to partition on for sharding. There must not be any other unique index keys.
- system
Indexes MongoCollection System Index[] - One or more
system_indexesblocks as defined below. - throughput number
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account_
name str - analytical_
storage_ intttl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale_
settings MongoCollection Autoscale Settings Args - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - database_
name str - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- default_
ttl_ intseconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices
Sequence[Mongo
Collection Index Args] - One or more
indexblocks as defined below. - name str
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- resource_
group_ strname - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- shard_
key str - The name of the key to partition on for sharding. There must not be any other unique index keys.
- system_
indexes Sequence[MongoCollection System Index Args] - One or more
system_indexesblocks as defined below. - throughput int
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
- account
Name String - analytical
Storage NumberTtl - The default time to live of Analytical Storage for this Mongo Collection. If present and the value is set to
-1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some numbern– items will expirenseconds after their last modified time. - autoscale
Settings Property Map - An
autoscale_settingsblock as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create. Requiresshard_keyto be set. - database
Name String - The name of the Cosmos DB Mongo Database in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- default
Ttl NumberSeconds - The default Time To Live in seconds. If the value is
-1or0, items are not automatically expired. - indices List<Property Map>
- One or more
indexblocks as defined below. - name String
- Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
- shard
Key String - The name of the key to partition on for sharding. There must not be any other unique index keys.
- system
Indexes List<Property Map> - One or more
system_indexesblocks as defined below. - throughput Number
- The throughput of the MongoDB collection (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual destroy/create.
Supporting Types
MongoCollectionAutoscaleSettings, MongoCollectionAutoscaleSettingsArgs
- Max
Throughput int - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
- Max
Throughput int - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
- max
Throughput Integer - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
- max
Throughput number - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
- max_
throughput int - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
- max
Throughput Number - The maximum throughput of the MongoDB collection (RU/s). Must be between
4,000and1,000,000. Must be set in increments of1,000. Conflicts withthroughput.
MongoCollectionIndex, MongoCollectionIndexArgs
MongoCollectionSystemIndex, MongoCollectionSystemIndexArgs
Import
CosmosDB Mongo Collection can be imported using the resource id, e.g.
$ pulumi import azure:cosmosdb/mongoCollection:MongoCollection collection1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/mongodbDatabases/db1/collections/collection1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
