der_Typ
der_Typ

Reputation: 21

Find builds where none of the artifacts have been downloaded using AQL

for cleanup purposes I am currently trying to build an AQL query that lists all builds where all respective artifacts have not been downloaded. This is what I have right now:

builds.find(
  {
    "created" : {"$before" : "2mo"},
    "name": {"$match":"* master"},
    "module.artifact.item.stat.downloads": {"$eq":null} 
  }
).limit(1000)

The problem with this is that I get all builds that include a single artifact with no downloads but others might be downloaded. So I would need to do another query per build to determine the download count of all artifacts.

Is there a way to tell AQL that all artifacts of a build have to match the query?

Upvotes: 2

Views: 942

Answers (1)

Sana Shahin
Sana Shahin

Reputation: 11

For your query I think this is the solution:

items.find(
    "name" : {"$match" : "*master"}
    "stat.downloads" : {"$eq" : null }
)

Please refer to the documentation for more info.

Upvotes: 1

Related Questions