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.
我正在尝试查询超过6个月的所有工件。如果我在查询中硬编码日期,我就可以删除它们。
{
"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
jfrog rt del --spec /tmp/foo.spec --dry-run
How can I do a query with a relative date? (e.g today - 6 months)
如何使用相对日期进行查询? (例如今天 - 6个月)
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.
我打算把它放到一个cron工作中,每次cron作业运行时我都不想使用spec文件。
1 个解决方案
#1
3
AQL queries support relative time operators.
AQL查询支持相对时间运算符。
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.
请参阅AQL相对时间运算符的完整文档。
#1
3
AQL queries support relative time operators.
AQL查询支持相对时间运算符。
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.
请参阅AQL相对时间运算符的完整文档。