当自动索引指定为 'true' 时,索引模式值不能为 'none'

Indexing mode value cannot be 'none' when automatic indexing is specified as 'true'

删除索引时,我在尝试插入文档时遇到以下错误:

{{
  "code": "BadRequest",
  "message": "Message: {\"Errors\":[\"Indexing mode value cannot be 'none' when automatic indexing is specified as 'true'.\"]}..."
}}

我正在使用 SDK 来执行此操作:

collection.IndexingPolicy.IndexingMode = IndexingMode.None;

client.ReplaceDocumentCollectionAsync(collection).Wait();

我在网上找不到关于此错误或指定自动索引到 true/false 的任何信息。

文档中似乎缺少此内容。

IndexingMode.None 的自动索引需要设置为 false

collection.IndexingPolicy.Automatic = false;

collection.IndexingPolicy.IndexingMode = IndexingMode.None;

client.ReplaceDocumentCollectionAsync(collection).Wait();