Finding inbound dependencies via Content library


I’m currently making an admin tool that intends to create a list of all images in a project that are no longer being used. So, using Content library, I’m first running a query to get all nodes of content type media:image, and then for each of those I run a query checking if there are any other nodes with _references containing the _id of the image node (as described in NoQL reference - Enonic Developer Portal ).

It seems to be working fine at first glance, but I was wondering if there is a more optimal approach? Is there a way to get all image nodes which have no inbound dependencies in just a single query?

I also saw the Content library has a getOutboundDependencies function, but is there no getInboundDependencies? Is that planned for a future release of the Content library perhaps?

What you’re doing is correct. Even if we implement getInboundDependencies, it will still do the same query search under the hood.

1 Like

Ok, thanks for the feedback! :slight_smile: