如何在 Cosmosdb Mongo API 中使用 Azure CLI 命令在集合创建时启用通配符索引?

How I can enable Wildcard index at the time of collection creation using Azure CLI command in Cosmosdb Mongo API?

az cosmosdb mongodb 集合创建 -g -a -d -n --idx @indexes.json

运行 这种格式的命令给出错误: 部署失败。相关 ID:..... 索引定义不包含“_id”索引规范。

我的indexes.json文件内容如下图:

[
   { "_id": 1 },
   {
     "key": 
        {"keys":["$**"]},
           "options":{"Wildcard":true}
    }
]

请尝试使用此 json。

"indexes": [
    {
        "key": {
            "keys": [
                "_id"
            ]
        }
    },
    {
        "key": {
            "keys": [
                "$**"
            ]
        }
    }
]