在Cosmos DB中获取文档大小 [英] Get document size in Cosmos DB

查看:63
本文介绍了在Cosmos DB中获取文档大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取或确定存储在Cosmos DB中的文档的大小?

How can I get or figure out the size of a document stored in Cosmos DB?

这已经存储在文档中了吗?

Is this something already stored within document?

推荐答案

如果获取(或查询)文档,则可以查看返回的标题,特别是x-ms-resource-usage,其中将包含documentsSize属性(以kb为单位表示文档的大小).

If you get (or query) a document, you can then look at the headers that come back, specifically x-ms-resource-usage, which will contain a documentsSize attribute (representing a document's size in kb).

在node/javascript中,您将拨打类似于以下内容的呼叫:

In node/javascript, you'd make a call that looks something like:

client.readDocument(docLink, function (err, doc, headers) {
  ...
})

您想看看headers['x-ms-resource-usage'].

这篇关于在Cosmos DB中获取文档大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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