Mongo DBResource Mongo DBCollection Args
An Azure Cosmos DB MongoDB collection. API Version: 2021-03-15.
Example Usage
CosmosDBMongoDBCollectionCreateUpdate
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var mongoDBResourceMongoDBCollection = new AzureNative.DocumentDB.MongoDBResourceMongoDBCollection("mongoDBResourceMongoDBCollection", new()
{
AccountName = "ddb1",
CollectionName = "collectionName",
DatabaseName = "databaseName",
Location = "West US",
Options = null,
Resource = new AzureNative.DocumentDB.Inputs.MongoDBCollectionResourceArgs
{
Id = "collectionName",
Indexes = new[]
{
new AzureNative.DocumentDB.Inputs.MongoIndexArgs
{
Key = new AzureNative.DocumentDB.Inputs.MongoIndexKeysArgs
{
Keys = new[]
{
"testKey",
},
},
Options = new AzureNative.DocumentDB.Inputs.MongoIndexOptionsArgs
{
ExpireAfterSeconds = 100,
Unique = true,
},
},
},
ShardKey =
{
{ "testKey", "Hash" },
},
},
ResourceGroupName = "rg1",
Tags = null,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.documentdb.MongoDBResourceMongoDBCollection;
import com.pulumi.azurenative.documentdb.MongoDBResourceMongoDBCollectionArgs;
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) {
var mongoDBResourceMongoDBCollection = new MongoDBResourceMongoDBCollection("mongoDBResourceMongoDBCollection", MongoDBResourceMongoDBCollectionArgs.builder()
.accountName("ddb1")
.collectionName("collectionName")
.databaseName("databaseName")
.location("West US")
.options()
.resource(Map.ofEntries(
Map.entry("id", "collectionName"),
Map.entry("indexes", Map.ofEntries(
Map.entry("key", Map.of("keys", "testKey")),
Map.entry("options", Map.ofEntries(
Map.entry("expireAfterSeconds", 100),
Map.entry("unique", true)
))
)),
Map.entry("shardKey", Map.of("testKey", "Hash"))
))
.resourceGroupName("rg1")
.tags()
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:documentdb:MongoDBResourceMongoDBCollection collectionName /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName
Constructors
Properties
Cosmos DB database account name.
Cosmos DB collection name.
Cosmos DB database name.
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
The standard JSON format of a MongoDB collection
The name of the resource group. The name is case insensitive.
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".