从文档中提取的 PartitionKey 与 header 中指定的不匹配

PartitionKey extracted from document doesn't match the one specified in the header

我在长字段 (playerId) 上创建了一个分区 collection,并且还在该字段 (DataType.Number) 上添加了一个哈希索引。当我插入记录时,大部分时间它都能正常工作,但有时它会给我一个 PartitionKey extracted from document doesn't match the one specified in the header

在 Azure 数据资源管理器中对此进行测试后,我发现长数字存在舍入问题。如果我通过 Data Explorer 插入 183548146777950021,它将保存它,但随后 return 对我来说是与 183548146777950000 相同的记录。这是一个已知问题吗?

我在 Direct/TCP 模式下使用最新的 .NET 客户端 1.23.2。

If I insert 183548146777950021 through Data Explorer it will save it, but then return that same record to me as 183548146777950000. Is this a known issue?

据我所知,Azure DocumentDB 对数字使用 IEEE754 标准,这可能会导致大整数或精度更高的小数的截断或精度损失。如果可能,您可以尝试将 playerId 字段修改并存储为字符串 "183548146777950021".

你可以参考这个类似的问题: