cts 查询以过滤过去 24 小时内特定集合中的文档
cts query to filter documents from a particular collection for the last 24 hours
我一直在尝试根据字段 report_time 从特定集合中查找文档。
我一直在尝试以下查询。但是,它不起作用。
cts.andQuery(cts.collectionQuery('myCollection'),cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString()))
从该片段中,需要调整的一件事是查询条件需要位于 cts.andQuery()
参数的数组中:
cts.andQuery([
cts.collectionQuery('myCollection'),
cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString())
])
您不必计算,可以使用“年龄查询”。请参阅页面末尾 https://docs.marklogic.com/guide/search-dev/rangequery
我一直在尝试根据字段 report_time 从特定集合中查找文档。
我一直在尝试以下查询。但是,它不起作用。
cts.andQuery(cts.collectionQuery('myCollection'),cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString()))
从该片段中,需要调整的一件事是查询条件需要位于 cts.andQuery()
参数的数组中:
cts.andQuery([
cts.collectionQuery('myCollection'),
cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString())
])
您不必计算,可以使用“年龄查询”。请参阅页面末尾 https://docs.marklogic.com/guide/search-dev/rangequery