Eagerloading loading a one to many relationship

Thank you very much for answering @ptpaterson. I was thinking that the way I can do this is by using spread operator, I learned about Merge function which is exactly what I needed.

Map(
  Paginate(
    Match(Index('shopProductsByShop'), Ref(Collection('shops'), '270198156233277958'))
  ),
  Lambda(
    'ref',
    Merge(
      Get(Var('ref')),
      {
        photos: Map(
          Paginate(
            Match(Index('productPhotosByProduct'), Var('ref'))
          ),
          Lambda(
            ['ref', 'productRef'],
            Get(Var('ref'))
          )
        )
      }
    )
  )
)