Dus*_*gal 5 azure azure-cosmosdb
timestamp我的每个文件中都有一个字段.时间戳采用ISODate格式.有没有办法在Document Explorer或Query Explorer中使用它对数据进行排序?
将日期存储为纪元,而不是 ISO 日期。如果您需要在文档中提供人类可读的日期,则可以存储两者。
请参阅此https://azure.microsoft.com/en-us/blog/working-with-dates-in-azure-documentdb-4/
- 根据评论和 Larry 的回答,您可以使用精度为 -1 的范围索引(范围索引的要求)。您可以从门户将索引要求设置为 json 或通过代码。
new IncludedPath {
Path = "/your_iso_property_path" ,
Indexes = new Collection<Index> {
new RangeIndex(DataType.String) { Precision = -1 }
}
});
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请参阅https://azure.microsoft.com/nb-no/documentation/articles/documentdb-indexing-policies/
如果您使用 API 创建集合或不久前使用门户创建集合,则字符串的默认索引将是哈希索引。
| 归档时间: |
|
| 查看次数: |
5044 次 |
| 最近记录: |