az cosmosdb mongodb collection

注意

此命令群組具有 Azure CLI 和至少一個擴充功能中定義的命令。 安裝每個擴充功能以受益於其擴充功能。 深入了解擴充功能。

管理 Azure Cosmos DB MongoDB 集合。

命令

名稱 Description 類型 狀態
az cosmosdb mongodb collection create

在 Azure Cosmos DB MongoDB 資料庫下建立 MongoDB 集合。

核心 GA
az cosmosdb mongodb collection delete

刪除 Azure Cosmos DB MongoDB 資料庫下的 MongoDB 集合。

核心 GA
az cosmosdb mongodb collection exists

檢查 Azure Cosmos DB MongoDB 集合是否存在。

核心 GA
az cosmosdb mongodb collection list

列出 Azure Cosmos DB MongoDB 資料庫底下的 MongoDB 集合。

核心 GA
az cosmosdb mongodb collection merge

合併 mongodb 集合的數據分割。

副檔名 預覽​​
az cosmosdb mongodb collection redistribute-partition-throughput

重新發佈 mongodb 集合的數據分割輸送量。

副檔名 預覽​​
az cosmosdb mongodb collection restore

還原相同帳戶內已刪除的 mongodb 集合。

核心 GA
az cosmosdb mongodb collection restore (cosmosdb-preview 擴充功能)

還原相同帳戶內已刪除的 mongodb 集合。

副檔名 預覽​​
az cosmosdb mongodb collection retrieve-partition-throughput

擷取 mongodb 集合的數據分割輸送量。

副檔名 預覽​​
az cosmosdb mongodb collection show

顯示 Azure Cosmos DB MongoDB 資料庫下 MongoDB 集合的詳細數據。

核心 GA
az cosmosdb mongodb collection throughput

在 Azure Cosmos DB 帳戶下管理 MongoDB 集合的輸送量。

核心 GA
az cosmosdb mongodb collection throughput migrate

在自動調整和手動布建之間移轉 MongoDB 集合的輸送量。

核心 GA
az cosmosdb mongodb collection throughput show

取得 Azure Cosmos DB MongoDB 資料庫下 MongoDB 集合的輸送量。

核心 GA
az cosmosdb mongodb collection throughput update

更新 Azure Cosmos DB MongoDB 資料庫下 MongoDB 集合的輸送量。

核心 GA
az cosmosdb mongodb collection update

更新 Azure Cosmos DB MongoDB 資料庫下的 MongoDB 集合。

核心 GA

az cosmosdb mongodb collection create

在 Azure Cosmos DB MongoDB 資料庫下建立 MongoDB 集合。

az cosmosdb mongodb collection create --account-name
                                      --database-name
                                      --name
                                      --resource-group
                                      [--analytical-storage-ttl]
                                      [--idx]
                                      [--max-throughput]
                                      [--shard]
                                      [--throughput]

範例

建立 Azure Cosmos DB MongoDB 集合。

az cosmosdb mongodb collection create -g MyResourceGroup -a MyAccount -d MyDatabase -n MyCollection --shard "ShardingKey" --idx @indexes-file.json --throughput "500"

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--analytical-storage-ttl

分析 TTL,啟用分析記憶體時。

--idx

索引,您可以將它輸入為字串或檔案, 例如,-idx 或 --idx @indexes-file.json “[{”key“: {”keys“: [”_ts“]},”options“: {”expireAfterSeconds“: 1000}}, {”key“: {”keys“: [”user_id“, ”user_address“]}, ”options“: {”unique“: ”true“}}]”。

--max-throughput

輸送量資源上限可以調整為 (RU/秒)。 提供資源啟用自動調整時。 最小值可以是 4000 (RU/秒)。

--shard

分區化索引鍵路徑。

--throughput

MongoDB 集合的輸送量(RU/秒)。 預設值為 400。 如果資料庫具有共用輸送量,除非集合應具有專用輸送量,否則請省略此參數。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection delete

刪除 Azure Cosmos DB MongoDB 資料庫下的 MongoDB 集合。

az cosmosdb mongodb collection delete --account-name
                                      --database-name
                                      --name
                                      --resource-group
                                      [--yes]

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--yes -y

不提示確認。

預設值: False
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection exists

檢查 Azure Cosmos DB MongoDB 集合是否存在。

az cosmosdb mongodb collection exists --account-name
                                      --database-name
                                      --name
                                      --resource-group

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection list

列出 Azure Cosmos DB MongoDB 資料庫底下的 MongoDB 集合。

az cosmosdb mongodb collection list --account-name
                                    --database-name
                                    --resource-group

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection merge

預覽

此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

合併 mongodb 集合的數據分割。

az cosmosdb mongodb collection merge --account-name
                                     --database-name
                                     --name
                                     --resource-group

範例

集合 my-mongodb-collection 的合併分割區

az cosmosdb mongodb collection merge -g my-resource-group -a my-account -d my-db --name my-mongodb-collection

必要參數

--account-name -a

CosmosDB 資料庫帳戶的名稱。

--database-name -d

mongoDB 資料庫的名稱。

--name -n

mongoDB 集合的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection redistribute-partition-throughput

預覽

此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

重新發佈 mongodb 集合的數據分割輸送量。

az cosmosdb mongodb collection redistribute-partition-throughput --account-name
                                                                 --database-name
                                                                 --name
                                                                 --resource-group
                                                                 [--evenly-distribute {false, true}]
                                                                 [--source-partition-info]
                                                                 [--target-partition-info]

範例

將 mongodb 集合的數據分割輸送量平均分散到所有實體分割區

az cosmosdb mongodb collection redistribute-partition-throughput --account-name account_name --database-name db_name --name container_name  --resource-group rg_name --evenly-distribute

將 mongodb 集合的數據分割輸送量從來源分割重新發佈至目標分割區

az cosmosdb mongodb collection redistribute-partition-throughput --account-name account_name --database-name db_name --name container_name  --resource-group rg_name --target-partition-info 8=1200 6=1200' --source-partition-info 9'

必要參數

--account-name -a

CosmosDB 資料庫帳戶的名稱。

--database-name -d

CosmosDB 資料庫名稱的名稱。

--name -n

CosmosDB 集合的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--evenly-distribute

切換為在所有實體分割區之間平均分散輸送量。

接受的值: false, true
預設值: False
--source-partition-info

空間分隔的來源實體分割區標識碼,例如:1 2。

預設值: []
--target-partition-info

所需目標實體分割區輸送量的相關信息,例如:『0=1200 1=1200』。

預設值: []
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection restore

還原相同帳戶內已刪除的 mongodb 集合。

az cosmosdb mongodb collection restore --account-name
                                       --database-name
                                       --name
                                       --resource-group
                                       [--restore-timestamp]

範例

還原相同帳戶內已刪除的 mongodb 集合。

az cosmosdb mongodb collection restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_collection_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--restore-timestamp -t

集合必須還原至的時間戳。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection restore (cosmosdb-preview 擴充功能)

預覽

此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

還原相同帳戶內已刪除的 mongodb 集合。

az cosmosdb mongodb collection restore --account-name
                                       --database-name
                                       --name
                                       --resource-group
                                       [--disable-ttl {false, true}]
                                       [--restore-timestamp]

範例

還原相同帳戶內已刪除的 mongodb 集合。

az cosmosdb mongodb collection restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_collection_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--disable-ttl
預覽

啟用或停用已停用ttl還原。

接受的值: false, true
--restore-timestamp -t

集合必須還原至的時間戳。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection retrieve-partition-throughput

預覽

此命令處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

擷取 mongodb 集合的數據分割輸送量。

az cosmosdb mongodb collection retrieve-partition-throughput --account-name
                                                             --database-name
                                                             --name
                                                             --resource-group
                                                             [--all-partitions {false, true}]
                                                             [--physical-partition-ids]

範例

擷取特定實體分割區的容器container_name輸送量

az cosmosdb mongodb collection retrieve-partition-throughput --account-name account_name --database-name db_name --name container_name  --resource-group rg_name --physical-partition-ids 8 9

擷取所有實體分割區的容器container_name輸送量

az cosmosdb mongodb collection retrieve-partition-throughput --account-name account_name --database-name db_name --name container_name  --resource-group rg_name --all-partitions

必要參數

--account-name -a

CosmosDB 資料庫帳戶的名稱。

--database-name -d

CosmosDB 資料庫名稱的名稱。

--name -n

CosmosDB 容器的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--all-partitions

切換以擷取所有實體分割區的輸送量。

接受的值: false, true
預設值: False
--physical-partition-ids -p

實體分割區標識子的空間分隔清單。

預設值: []
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection show

顯示 Azure Cosmos DB MongoDB 資料庫下 MongoDB 集合的詳細數據。

az cosmosdb mongodb collection show --account-name
                                    --database-name
                                    --name
                                    --resource-group

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az cosmosdb mongodb collection update

更新 Azure Cosmos DB MongoDB 資料庫下的 MongoDB 集合。

az cosmosdb mongodb collection update --account-name
                                      --database-name
                                      --name
                                      --resource-group
                                      [--analytical-storage-ttl]
                                      [--idx]

必要參數

--account-name -a

Cosmosdb 帳戶名稱。

--database-name -d

資料庫名稱。

--name -n

集合名稱。

--resource-group -g

資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。

選擇性參數

--analytical-storage-ttl

分析 TTL,啟用分析記憶體時。

--idx

索引,您可以將它輸入為字串或檔案, 例如,-idx 或 --idx @indexes-file.json “[{”key“: {”keys“: [”_ts“]},”options“: {”expireAfterSeconds“: 1000}}, {”key“: {”keys“: [”user_id“, ”user_address“]}, ”options“: {”unique“: ”true“}}]”。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。