findBy('uri) vs find()

I am trying to find a bunch of pages via Uri.

The pages are stored into:
content/collection/A/page-name

If I do:
$foundPage = page(‘collection’)->grandChildren()->findBy(‘uid’, ‘page-name’)
I do manage to find the page

If instead I do:
$foundPage = page(‘collection’)->grandChildren()->find(‘page-name’)
Nothing gets found.

How come?

I would like to find a way to make find() work because I have to find multiple pages from an array of uids.

You can’t use find() with grandchildren, I think. This would work:

$foundPage = page('collection/A')->children()->find('page-name');
1 Like