从输入 json 中排除某些键以不被 Azure CosmosDB 索引的正确 JSON 是什么?我们以 mongodb 模式使用 CosmosDB。计划在创建集合后更改 Azure 门户上的索引配置。
示例输入 Json 为
{
"name": "test",
"age": 1,
"location": "l1",
"height":5.7
}
Run Code Online (Sandbox Code Playgroud)
如果我要在索引中包含姓名和年龄并从索引中删除位置和高度,则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\"/?"
}
]
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3586 次 |
最近记录: |