Skip to the content.

Table of contents

Cozy DocRules doctype

io.cozy.docrules

This doctype represents docrules, i.e. rules used to retrieve documents in the Cozy.

Note the rule attributes, i.e. limit and selector can be parametrised by using a {var-name} notation. In the example below, {date} is a rule parameter used to find payslips before this date, while {limit} restricts the number of documents retrieved.

See here for an example on how to pass parameters to a rule.

Example

{
  "_id": "io.cozy.docrules/payslips",
  "description": "Get payslips from the given date",
  "doctype": "io.cozy.files",
  "rule": {
    "limit": "{limit}",
    "selector": {
      "cozyMetadata.classification": "payslip",
      "cozyMetadata.createdAt": {
        "$lt": "{date}"
      }
    }
  }
}