我一直在寻找天蓝色cosmosdb限制的权威来源我无法找到。特别是,我需要知道单个项目的大小限制。
答案 0 :(得分:13)
答案 1 :(得分:1)
因此,这是总是困扰我有关文档的事情之一。
当然,这是2MB,但是由谁来量算。
TLDR:介于2,090,014和2,100,014之间 Encoding.UTF8.GetByteCount(doc)或 Encoding.ASCII.GetByteCount(doc)
要到达那里,我设置了以下代码:
for (int i = 10; i < 10000; i++)
{
var docItem = new TestItem(new string('A', i * 10000));
string doc = JsonConvert.SerializeObject(docItem);
log.LogInformation(" ");
log.LogInformation(" -------------------------------------------------------------------------------------------------------------------------------------");
log.LogInformation($" ------------------------------------------------- Doc Size = {i*10000 } --------------------------------------------------");
log.LogInformation(" -------------------------------------------------------------------------------------------------------------------------------------");
log.LogWarning($"UTF7 - {Encoding.UTF7.GetByteCount(doc)}");
log.LogWarning($"UTF8 - {Encoding.UTF8.GetByteCount(doc)}");
log.LogWarning($"UTF32 - {Encoding.UTF32.GetByteCount(doc)}");
log.LogWarning($"Unicode - {Encoding.Unicode.GetByteCount(doc)}");
log.LogWarning($"Ascii - {Encoding.ASCII.GetByteCount(doc)}");
log.LogInformation(" -------------------------------------------------------------------------------------------------------------------------------------");
log.LogWarning($"UTF7 - {ASCIIEncoding.UTF7.GetByteCount(doc)}");
log.LogWarning($"UTF8 - {ASCIIEncoding.UTF8.GetByteCount(doc)}");
log.LogWarning($"UTF32 - {ASCIIEncoding.UTF32.GetByteCount(doc)}");
log.LogWarning($"Unicode - {ASCIIEncoding.Unicode.GetByteCount(doc)}");
log.LogWarning($"Ascii - {ASCIIEncoding.ASCII.GetByteCount(doc)}");
try
{
await cosmosStore.CreateDocumentAsync(docItem);
}
catch (Exception e)
{
log.LogWarning(e.Message + "Caught");
}
}