MongoCollection

class MongoCollection : KotlinCustomResource

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

Properties

Link copied to clipboard
val accountName: Output<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.

Link copied to clipboard

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
val databaseName: Output<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.

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

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

One or more index blocks as defined below.

Link copied to clipboard
val name: Output<String>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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>?

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

One or more system_indexes blocks as defined below.

Link copied to clipboard
val throughput: Output<Int>
Link copied to clipboard
val urn: Output<String>