-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
For a mongo 3.2 collection with a shard key, Get-AzCosmosDBMongoDBCollection does not return the shard key whereas Azure CLI does
Sample PS:
$collection = Get-AzCosmosDBMongoDBCollection -ResourceGroupName $resourceGroupName -AccountName $accountName -DatabaseName $databaseName -Name $collectionName
PS output:
$collection.Resource
Id :
ShardKey :
Indexes : {Microsoft.Azure.Commands.CosmosDB.Models.PSMongoIndexKeys, Microsoft.Azure.Commands.CosmosDB.Models.PSMongoIndexKeys,
Microsoft.Azure.Commands.CosmosDB.Models.PSMongoIndexKeys, Microsoft.Azure.Commands.CosmosDB.Models.PSMongoIndexKeys}
_rid : 08V3AI-vnrA=
_ts : 1584377689
_etag : "0000b500-0000-0100-0000-5e6faf590000"
Sample Azure CLI:
az cosmosdb mongodb collection show -g cosmos -a cdb-mongo-makz -d db1 -n c1
CLI output (note shard key):
Command group 'cosmosdb mongodb' is in preview. It may be changed/removed in a future release.
{
"id": "/subscriptions/e61e4c75-268b-4c94-ad48-237aa3231481/resourceGroups/cosmos/providers/Microsoft.DocumentDB/databaseAccounts/cdb-mongo-makz/mongodbDatabases/db1/collections/c1",
"location": null,
"name": "c1",
"resource": {
"id": "c1",
"indexes": [
{
"key": {
"keys": [
"_id"
]
},
"options": {
"expireAfterSeconds": null,
"unique": null
}
},
{
"key": {
"keys": [
"_ts"
]
},
"options": {
"expireAfterSeconds": 604800,
"unique": null
}
},
{
"key": {
"keys": [
"user_id",
"user_address"
]
},
"options": {
"expireAfterSeconds": null,
"unique": true
}
},
{
"key": {
"keys": [
"DocumentDBDefaultIndex"
]
},
"options": {
"expireAfterSeconds": null,
"unique": null
}
}
],
"shardKey": {
"user_id": "Hash"
}
},
"resourceGroup": "cosmos",
"tags": null,
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections"
}