我一直在尝试根据字段report_time从特定集合中查找文档。
我一直在尝试以下查询。但是,它不起作用。
cts.andQuery(cts.collectionQuery('myCollection'),cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString()))
从该片段中,需要调整的一件事是查询条件需要在cts.andQuery()
param:的数组中
cts.andQuery([
cts.collectionQuery('myCollection'),
cts.jsonPropertyRangeQuery("report_time", ">", new Date(Date.now() - 86400 * 1000).toISOString())
])
你不必计算,你可以使用一个"年龄查询";。请参阅页面末尾的https://docs.marklogic.com/guide/search-dev/rangequery