cts.estimate 显示错误的文档计数

cts.estimate showing wrong document count

我的要求是获取数据库中可用文档的总数。

cts.estimate(
  cts.trueQuery()
)

当我执行上面的查询时,它返回 1283265 文档计数,但是当我从 qconsole 浏览数据库时,文档计数是 1283262 所以我不确定这个文档计数不匹配。

感谢任何帮助。

有没有可能你数据库中有一些没有文档的URI?

支持查询控制台浏览按钮的代码仅报告估计的文档数:

let $total-doc := xdmp:estimate(doc())

cts.estimate() 的默认行为是搜索 any 片段。

Only one of "any", "document", "properties", or "locks" may be specified in the options parameter. If none of "any", "document", "properties", or "locks" are specified and there is a $query parameter, then the default is "document". If there is no $query parameter then the default is "any".

运行 此查询并验证在为估计指定显式选项时报告的数字:

const estimate_default = cts.estimate(cts.trueQuery());
const estimate_any = cts.estimate(cts.trueQuery(), ["any"]);
const estimate_documents = cts.estimate(cts.trueQuery(), ["document"]);
const estimate_properties = cts.estimate(cts.trueQuery(), ["properties"]);
const estimate_locks = cts.estimate(cts.trueQuery(), ["locks"]);

[estimate_default, estimate_any, estimate_documents, estimate_properties, estimate_locks];

我怀疑数字的差异是因为某些没有文档的 URI。例如,有可能具有 URI 的属性片段而没有文档。