存储在Azure Cosmos DB中的单个文档的大小限制是多少 [英] What is the size limit of a single document stored in Azure Cosmos DB

查看:107
本文介绍了存储在Azure Cosmos DB中的单个文档的大小限制是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure中有一个MongoDB数据库(在Cosmos DB帐户下注册),我在

I have a MongoDB database in Azure (registered under a Cosmos DB account) and I read on ms docs that the size limit per document stored is 2MB. However, when I try to store an image buffer that is around 1.7 MB I get the following error:

2019-11-01T00:43:14.057681416Z { MongoError: Message: {"Errors":["Request size is too large"]}
2019-11-01T00:43:14.057757320Z RequestStartTime: 2019-11-01T00:43:13.9695930Z, RequestEndTime: 2019-11-01T00:43:13.9995776Z,  Number of regions attempted:1
2019-11-01T00:43:14.057768921Z ResponseTime: 2019-11-01T00:43:13.9995776Z, StoreResult: StorePhysicalAddress: rntbd://cdb-ms-prod-centralus1-fd19.documents.azure.com:14112/apps/0806fa15-6a2d-4127-a73b-b1626ddd8af1/services/5618d8a3-dc06-4e8a-ba18-39d3b0c58add/partitions/d61f7139-78bf-423b-a4d7-747179270393/replicas/132167814077711166p/, LSN: -1, GlobalCommittedLsn: -1, PartitionKeyRangeId: , IsValid: True, StatusCode: 410, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: , UsingLocalLSN: False, TransportException: null, ResourceType: Document, OperationType: Create
2019-11-01T00:43:14.057779921Z SDK: Microsoft.Azure.Documents.Common/2.7.0
2019-11-01T00:43:14.057788121Z     at Function.create (/home/site/wwwroot/node_modules/mongodb/lib/core/error.js:44:12)
2019-11-01T00:43:14.057796322Z     at toError (/home/site/wwwroot/node_modules/mongodb/lib/utils.js:150:22)
2019-11-01T00:43:14.057804822Z     at coll.s.topology.insert (/home/site/wwwroot/node_modules/mongodb/lib/operations/common_functions.js:266:39)
2019-11-01T00:43:14.057813223Z     at handler (/home/site/wwwroot/node_modules/mongodb/lib/core/sdam/topology.js:1000:24)
2019-11-01T00:43:14.057821223Z     at wireProtocol.(anonymous function) (/home/site/wwwroot/node_modules/mongodb/lib/core/sdam/server.js:457:5)
2019-11-01T00:43:14.057829423Z     at /home/site/wwwroot/node_modules/mongodb/lib/core/connection/pool.js:408:18
2019-11-01T00:43:14.057837624Z     at process._tickCallback (internal/process/next_tick.js:61:11)
2019-11-01T00:43:14.057845624Z   driver: true,
2019-11-01T00:43:14.057853424Z   name: 'MongoError',
2019-11-01T00:43:14.057861125Z   index: 0,
2019-11-01T00:43:14.057868725Z   code: 16,
2019-11-01T00:43:14.057876326Z   errmsg:
2019-11-01T00:43:14.057886326Z    'Message: {"Errors":["Request size is too large"]}\r\n, RequestStats: \r\nRequestStartTime: 2019-11-01T00:43:13.9695930Z, RequestEndTime: 2019-11-01T00:43:13.9995776Z,  Number of regions attempted:1\r\nResponseTime: 2019-11-01T00:43:13.9995776Z, LSN: -1, GlobalCommittedLsn: -1, PartitionKeyRangeId: , IsValid: True, StatusCode: 410, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: , UsingLocalLSN: False, TransportException: null, ResourceType: Document, OperationType: Create\r\n, SDK: Microsoft.Azure.Documents.Common/2.7.0',
2019-11-01T00:43:14.057902127Z   [Symbol(mongoErrorContextSymbol)]: {} }

当前,我正在使用Azure for Students订阅,并且我一直在使用免费套餐来使用我的所有资源.我还阅读了此文档关于存储和吞吐量的信息,但是我不确定为了使一切正常运行,我需要修改什么.

Currently, I'm on an Azure for Students subscription and I've been using the free tier for all of my resources. I also read in this documentation on storage and throughput, but I'm not sure what I would have to modify in order to get things working.

有人可以建议吗?

推荐答案

文档的最大大小为2 MB,无法增加.在您的情况下,您可以将图像存储在Blob存储中,并将url作为属性附加到要保存的文档中,这将节省几个字节.

The maximum size of a document is 2 MB and cannot be increased. In your case you can store the image in blob storage and attach the url as a property to the document you are saving which will save few bytes.

这篇关于存储在Azure Cosmos DB中的单个文档的大小限制是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆