计算 MarkLogic 暂存数据库上具有 where 条件的 Json 文档的数量
Counting number of Json documents with a where condition on MarkLogic staging DB
我想知道我们是否可以在 MarkLogic 中编写一个 XQuery 来计算 JSON 个键为“source1”的文档
暂存 table 有多个集合 JSON 具有以下结构的文档:
{
"source": "source1",
"name": "John",
"DOB": "1-01-1990",
"load_date": "2021-10-23 10:23:55"
}
我正在尝试获取源为“source1”的文档总数。即,
Select count(*) from data-hub-staging where source='source1'
使用 JavaScript 模块,您可以使用 cts.jsonPropertyValueQuery()
in order to target the documents that have the source
property with the value source1
, and then use cts.estimate()
获取文档数:
cts.estimate(cts.jsonPropertyValueQuery("source", "source1"))
和等效的 XQuery 模块:
xdmp:estimate(cts:search(doc(), cts:json-property-value-query("source", "source1")))
我想知道我们是否可以在 MarkLogic 中编写一个 XQuery 来计算 JSON 个键为“source1”的文档
暂存 table 有多个集合 JSON 具有以下结构的文档:
{
"source": "source1",
"name": "John",
"DOB": "1-01-1990",
"load_date": "2021-10-23 10:23:55"
}
我正在尝试获取源为“source1”的文档总数。即,
Select count(*) from data-hub-staging where source='source1'
使用 JavaScript 模块,您可以使用 cts.jsonPropertyValueQuery()
in order to target the documents that have the source
property with the value source1
, and then use cts.estimate()
获取文档数:
cts.estimate(cts.jsonPropertyValueQuery("source", "source1"))
和等效的 XQuery 模块:
xdmp:estimate(cts:search(doc(), cts:json-property-value-query("source", "source1")))