Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzCosmosDBMongoDBCollection does not return ShardKey value even when it exists. #11339

Closed
plzm opened this issue Mar 16, 2020 · 4 comments
Closed
Assignees
Labels
CosmosDB Service Attention This issue is responsible by Azure service team.

Comments

@plzm
Copy link

plzm commented Mar 16, 2020

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"
}

@plzm plzm added CosmosDB Service Attention This issue is responsible by Azure service team. labels Mar 16, 2020
@ghost
Copy link

ghost commented Mar 16, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar, @srinathnarayanan, @southpolesteve, @shurd.

@plzm plzm removed the Service Attention This issue is responsible by Azure service team. label Mar 16, 2020
@dingmeng-xue dingmeng-xue added the Service Attention This issue is responsible by Azure service team. label Mar 18, 2020
@ghost
Copy link

ghost commented Mar 18, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar, @srinathnarayanan, @southpolesteve, @shurd.

@MehaKaushik
Copy link
Contributor

Thanks @plzm for reporting this, working on it. Targeting the S168.

@MehaKaushik
Copy link
Contributor

Addressed in #11388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CosmosDB Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants