dls:retention-rule-insert( $rules as element(dls:retention-rule)* ) as empty-sequence()
This function inserts retention rules into the database. They will be readable by the dls-user role and modifiable/deletable by the dls-admin role.
Parameters | |
---|---|
rules | The retention rule to be inserted. |
dls-admin
role is required to run
this function, or the privilege:http://marklogic.com/xdmp/privileges/dls-admin
xquery version "1.0-ml"; import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy"; dls:retention-rule-insert(( dls:retention-rule( "Rule1", "Keep the five most recent versions of Jim's documents that are 15 days old or newer", 5, xs:duration("P15D"), "Locate all documents authored by Jim", dls:author-query(xdmp:user("Jim"))), dls:retention-rule( "Rule2", "Retain the five most recent versions of documents that match the query below", 5, (), "Locate only docs that include 'Baz' and 'Disco'" , cts:and-query(( cts:word-query("Baz"), cts:word-query("Disco"))) ) )) (: Inserts the retention rules, 'Rule1' and 'Rule2', into the database. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.