Ibm cloud 如何在Cloudant中计算文档大小?
我将使用Cloudant存储从API返回的一些文档,如何估计文档所需的近似空间,下面是一个示例文档:Ibm cloud 如何在Cloudant中计算文档大小?,ibm-cloud,cloudant,Ibm Cloud,Cloudant,我将使用Cloudant存储从API返回的一些文档,如何估计文档所需的近似空间,下面是一个示例文档: { "document_tone": { "tone_categories": [ { "tones": [ { "score": 0.25482, "tone_id": "anger", "tone_name": "Anger" },
{
"document_tone": {
"tone_categories": [
{
"tones": [
{
"score": 0.25482,
"tone_id": "anger",
"tone_name": "Anger"
},
{
"score": 0.345816,
"tone_id": "disgust",
"tone_name": "Disgust"
},
{
"score": 0.121116,
"tone_id": "fear",
"tone_name": "Fear"
},
{
"score": 0.078903,
"tone_id": "joy",
"tone_name": "Joy"
},
{
"score": 0.199345,
"tone_id": "sadness",
"tone_name": "Sadness"
}
],
"category_id": "emotion_tone",
"category_name": "Emotion Tone"
}
]
}
}
谢谢如果您将json保存在一个文件中,您可以尝试以下方法
cat file.json | jq --compact-output '' | wc -c
上面的文件大约是398个字符。在Cloudant中,根据您的设置,您还可能会占用索引空间。此外,您可以对https://$USERNAME.Cloudant.com/$DATABASE发出GET请求。它将返回有关数据库的详细信息,以供您准确估计。更多信息可在此处找到:回答不错,+1file.json还需要
\u id
和\u rev
值。e、 g.“id:”6ba8ad584a941f773b1e73f3e30e9622“,”修订版:”1-8ebe0ed680c8165c10641a1b237918a2“,增加了存储要求。谢谢!我可以考虑每个字符2字节吗?如本参考文件所述: