MarkLogic Server 11.0 Product Documentation
dls.retentionRuleInsert

dls.retentionRuleInsert(
   rules as element(dls.retentionRule)[]
) as null

Summary

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.

Required Privileges

The dls-admin role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-admin

Example

// 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")]) ) ]);
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy