doc_count 是否包含 doc_del_count 用于 /db 调用
Does doc_count include doc_del_count for /db call
当我执行 Get /{db} 调用时,CouchDb 文档说明如下:
doc_count
(number) – 指定数据库中文档的计数。
doc_del_count
(number) – 已删除文档数
这是否意味着 doc_count
不包括已删除的文档数?
doc_count
排除已删除的文件。这很容易验证——我通过 Cloudant 仪表板创建了一个新数据库,创建了 4 个文档并删除了 1 个。所以:
curl -s 'https://skruger.cloudant.com/blaha/_all_docs'
{"total_rows":3,"offset":0,"rows":[
{"id":"3a4a3dc11a24e9aaa7e92688226e24f8","key":"3a4a3dc11a24e9aaa7e92688226e24f8","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"id":"b5f7d2935bc061fc0b5757223a02adf3","key":"b5f7d2935bc061fc0b5757223a02adf3","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"id":"b5f7d2935bc061fc0b5757223a02ec08","key":"b5f7d2935bc061fc0b5757223a02ec08","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}}
]}
和(为简洁起见对输出进行了修整):
curl -s 'https://skruger.cloudant.com/blaha' | jq .
{
"db_name": "blaha",
"doc_del_count": 1,
"doc_count": 3,
"disk_size": 202240,
"data_size": 4499,
}
当我执行 Get /{db} 调用时,CouchDb 文档说明如下:
doc_count
(number) – 指定数据库中文档的计数。doc_del_count
(number) – 已删除文档数
这是否意味着 doc_count
不包括已删除的文档数?
doc_count
排除已删除的文件。这很容易验证——我通过 Cloudant 仪表板创建了一个新数据库,创建了 4 个文档并删除了 1 个。所以:
curl -s 'https://skruger.cloudant.com/blaha/_all_docs'
{"total_rows":3,"offset":0,"rows":[
{"id":"3a4a3dc11a24e9aaa7e92688226e24f8","key":"3a4a3dc11a24e9aaa7e92688226e24f8","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"id":"b5f7d2935bc061fc0b5757223a02adf3","key":"b5f7d2935bc061fc0b5757223a02adf3","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"id":"b5f7d2935bc061fc0b5757223a02ec08","key":"b5f7d2935bc061fc0b5757223a02ec08","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}}
]}
和(为简洁起见对输出进行了修整):
curl -s 'https://skruger.cloudant.com/blaha' | jq .
{
"db_name": "blaha",
"doc_del_count": 1,
"doc_count": 3,
"disk_size": 202240,
"data_size": 4499,
}