0
votes

I'm trying to query all artifacts that are older than 6 months old. I'm able to delete them if I hard code a date into my query.

{
  "files": [
    {
      "aql": {
        "items.find": {
          "repo": "foobar",
          "$or": [
            {
              "$and": [
                {
                  "modified": { "$lt": "2016-10-18T21:26:52.000Z"}
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

jfrog rt del --spec /tmp/foo.spec --dry-run

How can I do a query with a relative date? (e.g today - 6 months)

I'm going to put this into a cron job, and I'd rather not munge a spec file every time the cron job runs.

1

1 Answers

3
votes

AQL queries support relative time operators.

In this case, modify the query:

"modified": { "$lt": "2016-10-18T21:26:52.000Z"}

To:

"modified": { "$before": "6mo"}

See full documantation at: AQL Relative Time Operators.