MongoCollectionArgs

data class MongoCollectionArgs(val accountName: Output<String>? = null, val analyticalStorageTtl: Output<Int>? = null, val autoscaleSettings: Output<MongoCollectionAutoscaleSettingsArgs>? = null, val databaseName: Output<String>? = null, val defaultTtlSeconds: Output<Int>? = null, val indices: Output<List<MongoCollectionIndexArgs>>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val shardKey: Output<String>? = null, val throughput: Output<Int>? = null) : ConvertibleToJava<MongoCollectionArgs>

Manages a Mongo Collection within a Cosmos DB Account.

Example Usage

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 exampleAccount = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
.name("tfex-cosmosdb-account")
.resourceGroupName("tfex-cosmosdb-account-rg")
.build());
var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
.resourceGroupName(exampleAccount.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
.accountName(exampleAccount.applyValue(getAccountResult -> getAccountResult.name()))
.build());
var exampleMongoCollection = new MongoCollection("exampleMongoCollection", MongoCollectionArgs.builder()
.resourceGroupName(exampleAccount.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
.accountName(exampleAccount.applyValue(getAccountResult -> getAccountResult.name()))
.databaseName(exampleMongoDatabase.name())
.defaultTtlSeconds("777")
.shardKey("uniqueKey")
.throughput(400)
.indices(MongoCollectionIndexArgs.builder()
.keys("_id")
.unique(true)
.build())
.build());
}
}

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

Constructors

Link copied to clipboard
fun MongoCollectionArgs(accountName: Output<String>? = null, analyticalStorageTtl: Output<Int>? = null, autoscaleSettings: Output<MongoCollectionAutoscaleSettingsArgs>? = null, databaseName: Output<String>? = null, defaultTtlSeconds: Output<Int>? = null, indices: Output<List<MongoCollectionIndexArgs>>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, shardKey: Output<String>? = null, throughput: Output<Int>? = null)

Functions

Link copied to clipboard
open override fun toJava(): MongoCollectionArgs

Properties

Link copied to clipboard
val accountName: Output<String>? = null

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.

Link copied to clipboard
val analyticalStorageTtl: Output<Int>? = null

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.

Link copied to clipboard
Link copied to clipboard
val databaseName: Output<String>? = null

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.

Link copied to clipboard
val defaultTtlSeconds: Output<Int>? = null

The default Time To Live in seconds. If the value is -1, items are not automatically expired.

Link copied to clipboard
val indices: Output<List<MongoCollectionIndexArgs>>? = null

One or more index blocks as defined below.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the Cosmos DB Mongo Collection. Changing this forces a new resource to be created.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which the Cosmos DB Mongo Collection is created. Changing this forces a new resource to be created.

Link copied to clipboard
val shardKey: Output<String>? = null

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.

Link copied to clipboard
val throughput: Output<Int>? = null