0
我似乎無法從C#SDK更新索引策略。無法更新索引策略
if (collection == null)
{
collection = Client
.CreateDocumentCollectionAsync(
databaseLink,
new DocumentCollection { Id = collectionId },
new RequestOptions { OfferType = "S1" })
.Result;
}
collection.IndexingPolicy.IndexingMode = IndexingMode.Consistent;
collection.IndexingPolicy.IncludedPaths.Add(new IncludedPath
{
Path = "/*",
Indexes = new System.Collections.ObjectModel.Collection<Index>
{
new RangeIndex(DataType.String) { Precision = -1 },
new RangeIndex(DataType.Number) { Precision = -1 },
new RangeIndex(DataType.Point)
}
});
不管是什麼,該指數看起來是這樣的:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Hash",
"dataType": "String",
"precision": 3
}
]
},
{
"path": "/\"_ts\"/?",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Hash",
"dataType": "String",
"precision": 3
}
]
}
],
"excludedPaths": []
}
我認爲這是默認的。
[DocumentDb:查詢沒有索引]的可能重複(http://stackoverflow.com/questions/32733740/documentdb-querying-without-an-index) –