Search code examples
marklogicmarklogic-10

Real time use case to use cts:after-query-timestamp


I want to understand more about cts:after-query-timestamp and real-time use-case/scenario to use this cts function.


Solution

  • The cts:after-query-timestamp() function is used to build a query to be used as the query criteria for cts:after-query(), which is used to find documents/fragments committed after a specified timestamp.

    For instance, if you want to find all of the documents that were inserted/updated within the last hour:

    cts:uris("", (), 
      cts:after-query(xdmp:wallclock-to-timestamp(fn:current-dateTime() - xs:dayTimeDuration("PT1H")))
    )