gpt4 book ai didi

azure-cosmosdb - 排除 Azure Cosmos DB 中的路径

转载 作者:行者123 更新时间:2023-12-02 20:35:33 24 4
gpt4 key购买 nike

从输入 json 中排除某些键以不被 Azure CosmosDB 索引的正确 JSON 是什么。我们以 mongodb 模式使用 CosmosDB。计划在创建集合后更改 Azure 门户上的索引配置。

示例输入 Json

{
"name": "test",
"age": 1,
"location": "l1",
"height":5.7
}

如果我要在索引中包含姓名和年龄,并从索引中删除位置和高度,则includedPaths 和exclusionPaths 会是什么样子。

最佳答案

终于让它与以下规范一起工作:-

{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [{
"path": "/*",
"indexes": [{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Hash",
"dataType": "String",
"precision": 3
}
]
}],
"excludedPaths": [{
"path": "/\"location\"/?"
},
{
"path": "/\"height\"/?"
}
]
}

关于azure-cosmosdb - 排除 Azure Cosmos DB 中的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47298959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com