-
Notifications
You must be signed in to change notification settings - Fork 46
Set CosmosDbCollection
Update an existing collection in a Cosmos DB database.
Set-CosmosDbCollection -Context <Context> [-Key <SecureString>] [-KeyType <String>]
[-Database <String>] -Id <String> [-IndexingPolicy <Policy>]
[-DefaultTimeToLive <Int32>] [-RemoveDefaultTimeToLive] [-UniqueKeyPolicy <Policy>]
[<CommonParameters>]Set-CosmosDbCollection -Context <Context> [-Key <SecureString>] [-KeyType <String>]
[-Database <String>] -Id <String> [-IndexingPolicyJson <String>]
[-DefaultTimeToLive <Int32>] [-RemoveDefaultTimeToLive] [-UniqueKeyPolicy <Policy>]
[<CommonParameters>]Set-CosmosDbCollection -Account <String> [-Key <SecureString>] [-KeyType <String>]
[-Database <String>] -Id <String> [-IndexingPolicyJson <String>]
[-DefaultTimeToLive <Int32>] [-RemoveDefaultTimeToLive] [-UniqueKeyPolicy <Policy>]
[<CommonParameters>]Set-CosmosDbCollection -Account <String> [-Key <SecureString>] [-KeyType <String>]
[-Database <String>] -Id <String> [-IndexingPolicy <Policy>]
[-DefaultTimeToLive <Int32>] [-RemoveDefaultTimeToLive] [-UniqueKeyPolicy <Policy>]
[<CommonParameters>]This cmdlet will update an existing collection in a Cosmos DB. Only the indexing policy on a collection can be updated.
PS C:\> $indexStringRange = New-CosmosDbCollectionIncludedPathIndex -Kind Range -DataType String -Precision -1
PS C:\> $indexNumberRange = New-CosmosDbCollectionIncludedPathIndex -Kind Range -DataType Number -Precision -1
PS C:\> $indexIncludedPath = New-CosmosDbCollectionIncludedPath -Path '/*' -Index $indexStringRange, $indexNumberRange
PS C:\> $newIndexingPolicy = New-CosmosDbCollectionIndexingPolicy -Automatic $true -IndexingMode Consistent -IncludedPath $indexIncludedPath
PS C:\> Set-CosmosDbCollection -Context $cosmosDbContext -Id 'MyExistingCollection' -IndexingPolicy $newIndexingPolicyUpdate a collection in the database with the a new indexing policy.
PS C:\> Set-CosmosDbCollection -Context $cosmosDbContext -Id 'MyExistingCollection' -DefaultTimeToLive 7200Update a collection in the database with the a new default time to live of 7200 seconds.
PS C:\> Set-CosmosDbCollection -Context $cosmosDbContext -Id 'MyExistingCollection' -RemoveDefaultTimeToLiveUpdate a collection in the database by removing the default time to live setting.
The account name of the Cosmos DB to access.
Type: String
Parameter Sets: AccountIndexPolicyJson, AccountIndexPolicy
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is an object containing the context information of the Cosmos DB database that will be deleted. It should be created by `New-CosmosDbContext`.
Type: Context
Parameter Sets: ContextIndexPolicy, ContextIndexPolicyJson
Aliases: Connection
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe name of the database to access in the Cosmos DB account.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSetting this value to a positive integer will enable the time to live on all documents in this collection. If this is set to -1 then the default time to live will be infinite.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is the Id of the collection to update.
Type: String
Parameter Sets: (All)
Aliases: Name
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is an Indexing Policy object that was created by the Set-CosmosDbCollectionIndexingPolicy function. It should not be set if IndexingPolicyJson is set.
Type: Policy
Parameter Sets: ContextIndexPolicy, AccountIndexPolicy
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is a JSON representation of an Indexing Policy. It should not be set if IndexingPolicy is set.
Type: String
Parameter Sets: ContextIndexPolicyJson, AccountIndexPolicyJson
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe key to be used to access this Cosmos DB.
Type: SecureString
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe type of key that will be used to access ths Cosmos DB.
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: master, resource
Required: False
Position: Named
Default value: Master
Accept pipeline input: False
Accept wildcard characters: FalseIf this switch is set then the default time to live setting on the collection will be removed if it is set. This switch should not be set if the DefaultTimeToLive parameter is specified.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is a Unique Key Policy object that was created by the New-CosmosDbCollectionUniquePolicy function.
Type: Policy
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- ConvertTo-CosmosDbTokenDateString
- Get-CosmosDbAccount
- Get-CosmosDbAccountConnectionString
- Get-CosmosDbAccountMasterKey
- Get-CosmosDbAttachment
- Get-CosmosDbAttachmentResourcePath
- Get-CosmosDbAuthorizationHeaderFromContext
- Get-CosmosDbCollection
- Get-CosmosDbCollectionResourcePath
- Get-CosmosDbDatabase
- Get-CosmosDbDatabaseResourcePath
- Get-CosmosDbDocument
- Get-CosmosDbDocumentResourcePath
- Get-CosmosDbEntraIdToken
- Get-CosmosDbOffer
- Get-CosmosDbOfferResourcePath
- Get-CosmosDbPermission
- Get-CosmosDbPermissionResourcePath
- Get-CosmosDbStoredProcedure
- Get-CosmosDbStoredProcedureResourcePath
- Get-CosmosDbTrigger
- Get-CosmosDbTriggerResourcePath
- Get-CosmosDbUri
- Get-CosmosDbUser
- Get-CosmosDbUserDefinedFunction
- Get-CosmosDbUserDefinedFunctionResourcePath
- Get-CosmosDbUserResourcePath
- Invoke-CosmosDbRequest
- Invoke-CosmosDbStoredProcedure
- New-CosmosDbAccount
- New-CosmosDbAccountMasterKey
- New-CosmosDbAttachment
- New-CosmosDbBackoffPolicy
- New-CosmosDbContext
- New-CosmosDbCollection
- New-CosmosDbCollectionExcludedPath
- New-CosmosDbCollectionIncludedPath
- New-CosmosDbCollectionIncludedPathIndex
- New-CosmosDbCollectionIndexingPolicy
- New-CosmosDbCollectionUniqueKey
- New-CosmosDbCollectionUniqueKeyPolicy
- New-CosmosDbDatabase
- New-CosmosDbDocument
- New-CosmosDbInvalidArgumentException
- New-CosmosDbInvalidOperationException
- New-CosmosDbPermission
- New-CosmosDbStoredProcedure
- New-CosmosDbTrigger
- New-CosmosDbUser
- New-CosmosDbUserDefinedFunction
- Remove-CosmosDbAccount
- Remove-CosmosDbAttachment
- Remove-CosmosDbCollection
- Remove-CosmosDbDatabase
- Remove-CosmosDbDocument
- Remove-CosmosDbPermission
- Remove-CosmosDbStoredProcedure
- Remove-CosmosDbTrigger
- Remove-CosmosDbUser
- Remove-CosmosDbUserDefinedFunction
- Set-CosmosDbAccount
- Set-CosmosDbAttachment
- Set-CosmosDbAttachmentType
- Set-CosmosDbCollectionType
- Set-CosmosDbDatabaseType
- Set-CosmosDbDocument
- Set-CosmosDbDocumentType
- Set-CosmosDbOffer
- Set-CosmosDbOfferType
- Set-CosmosDbPermissionType
- Set-CosmosDbStoredProcedure
- Set-CosmosDbStoredProcedureType
- Set-CosmosDbTrigger
- Set-CosmosDbTriggerType
- Set-CosmosDbUser
- Set-CosmosDbUserDefinedFunction
- Set-CosmosDbUserDefinedFunctionType
- Set-CosmosDbUserType