1. Packages
  2. Azure Classic
  3. API Docs
  4. cosmosdb
  5. MongoCollection

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.cosmosdb.MongoCollection

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manages a Mongo Collection within a Cosmos DB Account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.cosmosdb.getAccount({
        name: "tfex-cosmosdb-account",
        resourceGroupName: "tfex-cosmosdb-account-rg",
    });
    const exampleMongoDatabase = new azure.cosmosdb.MongoDatabase("example", {
        name: "tfex-cosmos-mongo-db",
        resourceGroupName: example.then(example => example.resourceGroupName),
        accountName: example.then(example => example.name),
    });
    const exampleMongoCollection = new azure.cosmosdb.MongoCollection("example", {
        name: "tfex-cosmos-mongo-db",
        resourceGroupName: example.then(example => example.resourceGroupName),
        accountName: example.then(example => example.name),
        databaseName: exampleMongoDatabase.name,
        defaultTtlSeconds: 777,
        shardKey: "uniqueKey",
        throughput: 400,
        indices: [{
            keys: ["_id"],
            unique: true,
        }],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
        resource_group_name="tfex-cosmosdb-account-rg")
    example_mongo_database = azure.cosmosdb.MongoDatabase("example",
        name="tfex-cosmos-mongo-db",
        resource_group_name=example.resource_group_name,
        account_name=example.name)
    example_mongo_collection = azure.cosmosdb.MongoCollection("example",
        name="tfex-cosmos-mongo-db",
        resource_group_name=example.resource_group_name,
        account_name=example.name,
        database_name=example_mongo_database.name,
        default_ttl_seconds=777,
        shard_key="uniqueKey",
        throughput=400,
        indices=[{
            "keys": ["_id"],
            "unique": True,
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, 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, "example", &cosmosdb.MongoDatabaseArgs{
    			Name:              pulumi.String("tfex-cosmos-mongo-db"),
    			ResourceGroupName: pulumi.String(example.ResourceGroupName),
    			AccountName:       pulumi.String(example.Name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cosmosdb.NewMongoCollection(ctx, "example", &cosmosdb.MongoCollectionArgs{
    			Name:              pulumi.String("tfex-cosmos-mongo-db"),
    			ResourceGroupName: pulumi.String(example.ResourceGroupName),
    			AccountName:       pulumi.String(example.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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.CosmosDB.GetAccount.Invoke(new()
        {
            Name = "tfex-cosmosdb-account",
            ResourceGroupName = "tfex-cosmosdb-account-rg",
        });
    
        var exampleMongoDatabase = new Azure.CosmosDB.MongoDatabase("example", new()
        {
            Name = "tfex-cosmos-mongo-db",
            ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
            AccountName = example.Apply(getAccountResult => getAccountResult.Name),
        });
    
        var exampleMongoCollection = new Azure.CosmosDB.MongoCollection("example", new()
        {
            Name = "tfex-cosmos-mongo-db",
            ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
            AccountName = example.Apply(getAccountResult => getAccountResult.Name),
            DatabaseName = exampleMongoDatabase.Name,
            DefaultTtlSeconds = 777,
            ShardKey = "uniqueKey",
            Throughput = 400,
            Indices = new[]
            {
                new Azure.CosmosDB.Inputs.MongoCollectionIndexArgs
                {
                    Keys = new[]
                    {
                        "_id",
                    },
                    Unique = true,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
    import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
    import com.pulumi.azure.cosmosdb.MongoDatabase;
    import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
    import com.pulumi.azure.cosmosdb.MongoCollection;
    import com.pulumi.azure.cosmosdb.MongoCollectionArgs;
    import com.pulumi.azure.cosmosdb.inputs.MongoCollectionIndexArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
                .name("tfex-cosmosdb-account")
                .resourceGroupName("tfex-cosmosdb-account-rg")
                .build());
    
            var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
                .name("tfex-cosmos-mongo-db")
                .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
                .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
                .build());
    
            var exampleMongoCollection = new MongoCollection("exampleMongoCollection", MongoCollectionArgs.builder()
                .name("tfex-cosmos-mongo-db")
                .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
                .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
                .databaseName(exampleMongoDatabase.name())
                .defaultTtlSeconds("777")
                .shardKey("uniqueKey")
                .throughput(400)
                .indices(MongoCollectionIndexArgs.builder()
                    .keys("_id")
                    .unique(true)
                    .build())
                .build());
    
        }
    }
    
    resources:
      exampleMongoDatabase:
        type: azure:cosmosdb:MongoDatabase
        name: example
        properties:
          name: tfex-cosmos-mongo-db
          resourceGroupName: ${example.resourceGroupName}
          accountName: ${example.name}
      exampleMongoCollection:
        type: azure:cosmosdb:MongoCollection
        name: example
        properties:
          name: tfex-cosmos-mongo-db
          resourceGroupName: ${example.resourceGroupName}
          accountName: ${example.name}
          databaseName: ${exampleMongoDatabase.name}
          defaultTtlSeconds: '777'
          shardKey: uniqueKey
          throughput: 400
          indices:
            - keys:
                - _id
              unique: true
    variables:
      example:
        fn::invoke:
          Function: azure:cosmosdb:getAccount
          Arguments:
            name: tfex-cosmosdb-account
            resourceGroupName: tfex-cosmosdb-account-rg
    

    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:

    AccountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    DatabaseName 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.
    ResourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    AnalyticalStorageTtl int
    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 number n – items will expire n seconds after their last modified time.
    AutoscaleSettings MongoCollectionAutoscaleSettings
    DefaultTtlSeconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    Indices List<MongoCollectionIndex>
    One or more index blocks as defined below.
    Name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    ShardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    Throughput int
    AccountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    DatabaseName 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.
    ResourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    AnalyticalStorageTtl int
    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 number n – items will expire n seconds after their last modified time.
    AutoscaleSettings MongoCollectionAutoscaleSettingsArgs
    DefaultTtlSeconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    Indices []MongoCollectionIndexArgs
    One or more index blocks as defined below.
    Name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    ShardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    Throughput int
    accountName String
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    databaseName 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.
    resourceGroupName String
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl Integer
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings MongoCollectionAutoscaleSettings
    defaultTtlSeconds Integer
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices List<MongoCollectionIndex>
    One or more index blocks as defined below.
    name String
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    shardKey String
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    throughput Integer
    accountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    databaseName 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.
    resourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl number
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings MongoCollectionAutoscaleSettings
    defaultTtlSeconds number
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices MongoCollectionIndex[]
    One or more index blocks as defined below.
    name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    shardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    throughput number
    account_name str
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    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_name str
    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_ttl int
    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 number n – items will expire n seconds after their last modified time.
    autoscale_settings MongoCollectionAutoscaleSettingsArgs
    default_ttl_seconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices Sequence[MongoCollectionIndexArgs]
    One or more index blocks as defined below.
    name str
    Specifies the name of the Cosmos DB Mongo Collection. 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. Changing this forces a new resource to be created.
    throughput int
    accountName String
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    databaseName 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.
    resourceGroupName String
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl Number
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings Property Map
    defaultTtlSeconds Number
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices List<Property Map>
    One or more index blocks as defined below.
    name String
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    shardKey String
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    throughput Number

    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.
    SystemIndexes List<MongoCollectionSystemIndex>
    One or more system_indexes blocks as defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    SystemIndexes []MongoCollectionSystemIndex
    One or more system_indexes blocks as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    systemIndexes List<MongoCollectionSystemIndex>
    One or more system_indexes blocks as defined below.
    id string
    The provider-assigned unique ID for this managed resource.
    systemIndexes MongoCollectionSystemIndex[]
    One or more system_indexes blocks as defined below.
    id str
    The provider-assigned unique ID for this managed resource.
    system_indexes Sequence[MongoCollectionSystemIndex]
    One or more system_indexes blocks as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    systemIndexes List<Property Map>
    One or more system_indexes blocks 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) -> MongoCollection
    func 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)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    AccountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    AnalyticalStorageTtl int
    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 number n – items will expire n seconds after their last modified time.
    AutoscaleSettings MongoCollectionAutoscaleSettings
    DatabaseName 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.
    DefaultTtlSeconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    Indices List<MongoCollectionIndex>
    One or more index blocks as defined below.
    Name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    ShardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    SystemIndexes List<MongoCollectionSystemIndex>
    One or more system_indexes blocks as defined below.
    Throughput int
    AccountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    AnalyticalStorageTtl int
    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 number n – items will expire n seconds after their last modified time.
    AutoscaleSettings MongoCollectionAutoscaleSettingsArgs
    DatabaseName 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.
    DefaultTtlSeconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    Indices []MongoCollectionIndexArgs
    One or more index blocks as defined below.
    Name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    ShardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    SystemIndexes []MongoCollectionSystemIndexArgs
    One or more system_indexes blocks as defined below.
    Throughput int
    accountName String
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl Integer
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings MongoCollectionAutoscaleSettings
    databaseName 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.
    defaultTtlSeconds Integer
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices List<MongoCollectionIndex>
    One or more index blocks as defined below.
    name String
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    shardKey String
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    systemIndexes List<MongoCollectionSystemIndex>
    One or more system_indexes blocks as defined below.
    throughput Integer
    accountName string
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl number
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings MongoCollectionAutoscaleSettings
    databaseName 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.
    defaultTtlSeconds number
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices MongoCollectionIndex[]
    One or more index blocks as defined below.
    name string
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    shardKey string
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    systemIndexes MongoCollectionSystemIndex[]
    One or more system_indexes blocks as defined below.
    throughput number
    account_name str
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analytical_storage_ttl int
    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 number n – items will expire n seconds after their last modified time.
    autoscale_settings MongoCollectionAutoscaleSettingsArgs
    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_seconds int
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices Sequence[MongoCollectionIndexArgs]
    One or more index blocks 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_name str
    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. Changing this forces a new resource to be created.
    system_indexes Sequence[MongoCollectionSystemIndexArgs]
    One or more system_indexes blocks as defined below.
    throughput int
    accountName String
    The name of the Cosmos DB Account in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    analyticalStorageTtl Number
    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 number n – items will expire n seconds after their last modified time.
    autoscaleSettings Property Map
    databaseName 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.
    defaultTtlSeconds Number
    The default Time To Live in seconds. If the value is -1, items are not automatically expired.
    indices List<Property Map>
    One or more index blocks as defined below.
    name String
    Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.
    shardKey String
    The name of the key to partition on for sharding. There must not be any other unique index keys. Changing this forces a new resource to be created.
    systemIndexes List<Property Map>
    One or more system_indexes blocks as defined below.
    throughput Number

    Supporting Types

    MongoCollectionAutoscaleSettings, MongoCollectionAutoscaleSettingsArgs

    MaxThroughput int
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
    MaxThroughput int
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
    maxThroughput Integer
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
    maxThroughput number
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
    max_throughput int
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
    maxThroughput Number
    The maximum throughput of the MongoDB collection (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.

    MongoCollectionIndex, MongoCollectionIndexArgs

    Keys List<string>
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    Unique bool

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    Keys []string
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    Unique bool

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    keys List<String>
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    unique Boolean

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    keys string[]
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    unique boolean

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    keys Sequence[str]
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    unique bool

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    keys List<String>
    Specifies the list of user settable keys for each Cosmos DB Mongo Collection.
    unique Boolean

    Is the index unique or not? Defaults to false.

    Note: An index with an "_id" key must be specified.

    MongoCollectionSystemIndex, MongoCollectionSystemIndexArgs

    Keys List<string>
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    Unique bool
    Identifies whether the table contains no duplicate values.
    Keys []string
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    Unique bool
    Identifies whether the table contains no duplicate values.
    keys List<String>
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    unique Boolean
    Identifies whether the table contains no duplicate values.
    keys string[]
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    unique boolean
    Identifies whether the table contains no duplicate values.
    keys Sequence[str]
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    unique bool
    Identifies whether the table contains no duplicate values.
    keys List<String>
    The list of system keys which are not settable for each Cosmos DB Mongo Collection.
    unique Boolean
    Identifies whether the table contains no duplicate values.

    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 azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi