dls.retentionRuleInsert( rules as element(dls.retentionRule)[] ) as null
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
// Inserts the retention rules, 'Rule1' and 'Rule2', into the database. const dls = require("/MarkLogic/dls"); declareUpdate(); dls.retentionRuleInsert([ dls.retentionRule( "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.authorQuery(xdmp.user("Jim"))), dls.retentionRule( "Rule2", "Retain the five most recent versions of documents that match the query below", 5, '', "Locate only docs that include 'Baz' and 'Disco'" , cts.andQuery([ cts.wordQuery("Baz"), cts.wordQuery("Disco")]) ) ]);