简体   繁体   中英

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

az cosmosdb mongodb collection create -g -a -d -n --idx @indexes.json

Running command in this format is giving error: Deployment failed. Correlation ID: ..... Index definition does not contains '_id' index specification.

My indexes.json file content is as shown underneath:

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

Try using this json instead.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM