cosmosdb mongodb collection update cannot set default TTL to -1
See original GitHub issueDescribe the bug
When attempting to enable TTL on cosmosdb mongo collection with no default, TTL is disabled instead.
To Reproduce:
Run the following command on an existing cosmosdb mongodb collection:
az cosmosdb mongodb collection update --account-name {} --resource-group {} --database-name {} --name {} --idx "[{\"key\": {\"keys\": [\"_ts\"]},\"options\": {\"expireAfterSeconds\": -1}}]"
When inspecting the result in mongo shell, the result looks like this:
{
"v" : 1,
"key" : {
"_ts" : 1
},
"name" : "_ts_1",
"ns" : "db.collection"
}
Expected Behavior
The command should set default TTL to -1
{
"expireAfterSeconds" : -1,
"v" : 1,
"key" : {
"_ts" : 1
},
"name" : "_ts_1",
"ns" : "db.collection"
}
Environment Summary
Windows-10-10.0.17763-SP0
Python 3.6.6
Installer: MSI
azure-cli 2.5.0
Additional Context
Note that setting default TTL to -1 works fine if I use the deprecated command
az cosmosdb collection update --name {} --resource-group-name {} --db-name {} --collection-name {} --default-ttl -1
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
MongoDB per-document TTL feature in Azure Cosmos DB
Two modes are supported: setting a default TTL value on the whole collection, and setting individual TTL values for each document. The logic ......
Read more >Azure Cosmos DB Set collection TTL as - on (No Default) via ...
DefaultTTL for the collection. If missing (or set to null), documents are not deleted automatically. If present and the value is set to...
Read more >TTL Indexes — MongoDB Manual
TTL indexes are special single-field indexes that MongoDB can use to automatically remove documents from a collection after a certain amount of time...
Read more >azurerm_cosmosdb_account | Resources | hashicorp/azurerm
Defaults to FirstPartyIdentity . kind - (Optional) Specifies the Kind of CosmosDB to create - possible values are GlobalDocumentDB , MongoDB and ...
Read more >connect-mongo - npm
By default, connect-mongo uses MongoDB's TTL collection feature (2.2+) to have mongod automatically remove expired sessions. But you can change ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @nohajc, I am looking into this issue. I will update once I finish my investigation
Since we do not have a timeline for this ask in the near future and we tracking it internally, I am closing this issue from github.